zono

Untitled

Sep 21st, 2011
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.48 KB | None | 0 0
  1. #!/bin/bash
  2. # Proper header for a Bash script.
  3.  
  4. # Cleanup, version 2
  5.  
  6. # Run as root, of course.
  7. # Insert code here to print error message and exit if not root.
  8.  
  9. LOG_DIR=/var/log
  10. # Variables are better than hard-coded values.
  11. cd $LOG_DIR
  12.  
  13. cat /dev/null > messages
  14. cat /dev/null > wtmp
  15.  
  16.  
  17. echo "Logs cleaned up."
  18.  
  19. exit #  The right and proper method of "exiting" from a script.
  20.      #  A bare "exit" (no parameter) returns the exit status
  21.      #+ of the preceding command.
Advertisement
Add Comment
Please, Sign In to add comment