LDP/LDP/guide/docbook/abs-guide/ex1a.sh

22 lines
471 B
Bash
Raw Normal View History

2004-04-28 12:08:24 +00:00
#!/bin/bash
# Proper header for a Bash script.
# Cleanup, version 2
# Run as root, of course.
# Insert code here to print error message and exit if not root.
2005-03-21 13:51:11 +00:00
LOG_DIR=/var/log
2004-04-28 12:08:24 +00:00
# Variables are better than hard-coded values.
cd $LOG_DIR
cat /dev/null > messages
cat /dev/null > wtmp
echo "Logs cleaned up."
2011-05-03 15:38:48 +00:00
exit # The right and proper method of "exiting" from a script.
# A bare "exit" (no parameter) returns the exit status
#+ of the preceding command.