Wednesday, April 9, 2008

Sample Shell scripts Examples:

Shell scripts use to automate your daily tasks and make life peaceful =====================================================================================A simple 3 line shell script to check if the doent exists then backup the logfile with date suffix and create the new logfile. if the file exists then do nothing#!/usr/bin/kshif [[ ! -f /home/jack/app/donotrun.tmp ]] ; thenmv /tmp/app.log /tmp/app.log.`date +%Y%m%d%H%M` touch /tmp/app.logfi____________________________________________________________________Examples 1 .

The dailylogbackup script is used to backup the log files on dailybasis with date suffix This script is called with a PARM file which lists all the logfiles to be backed up (on a daily basis).# Input parms: