0 Replies - 1708 Views - Last Post: 28 September 2005 - 12:53 PM

#1 zeethreedee   User is offline

  • New D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 27-July 05

Basic System log backup

Posted 28 September 2005 - 12:53 PM

Description: Just make it into an executable file and run at the bash shell. eg: ./logbackup.sh Its easy to use and will check that you have super user statas before running.Does what it says on the tin. This script will create a logfiles in a backup folder and clean your old logs up. Each time you run it it will append the data from your log to the backup.
# Legal: released under the GPL licence, with not warranty to the 
# full extent that the law provides.

# Backup your log files on a regular basis, add this script to 
# your cron jobs list.

# Please distribute this script as you see fit but credit where 
# credits due. 
# AUTHOR: Lawrence Goldstien <[email protected]>
# PROJECT: the linux script bible
# UNIX NAME: script-bible
# WWW: http://script-bible.sourceforge.net/

# Setting up variables


# Run as root, of course.
if [ "$UID" -ne "$ROOT_UID" ]
   echo "You are not the god, you must r00t to run this script."
   exit $E_NOTROOT

# CD to the system log directory

# Make the backup directory

# Append system messages to the backup
cat messages > $BACKUP_DIR/messages

# Append system messages to the backup
cat wtmp > $BACKUP_DIR/wtmp

# Fill logs with nothingness
cat /dev/null > $LOG_DIR/messages
cat /dev/null > $LOG_DIR/wtmp

# And your done
echo "Logs cleared, you're all done here."

# Quit

Is This A Good Question/Topic? 0
  • +

Page 1 of 1