Backup with shell program and cron job.
The object of my program is to take automatic backup on daily basis to different folders. I have created the respective folders. when I execute below given shell program manually it is working perfectly and taking the backup to respective folder.
#script to take backup on day basis, This is going to run from cron job.
case $yourch in
1) exp backuser/backuser@linux1 file=/disk4/backup/Mon/linux1_Mon.dmp log=/disk4
/backup/Mon/linux1_Mon.log full=y direct=Y compress=N rows=N; exit 0;;
2) exp backuser/backuser@linux1 file=/disk4/backup/Tue/linux1_Tue.dmp log=/disk4
/backup/Tue/linux1_Tue.log full=y direct=Y compress=N rows=N; exit 0;;
3) exp backuser/backuser@linux1 file=/disk4/backup/Wed/linux1_Wed.dmp log=/disk4
/backup/Wed/linux1_Wed.log full=y direct=Y compress=N;rows=Y exit 0;;
4) exp backuser/backuser@linux1 file=/disk4/backup/Thu/linux1_Thu.dmp log=/disk4
/backup/Thu/linux1_Thu.log full=y direct=Y compress=N rows=N; exit 0;;
5) exp backuser/backuser@linux1 file=/disk4/backup/Fri/linux1_Fri.dmp log=/disk4
/backup/Fri/linux1_Fri.log full=y direct=Y compress=N rows=N; exit 0;;
6) exp backuser/backuser@linux1 file=/disk4/backup/Sat/linux1_Sat.dmp log=/disk4
/backup/Sat/linux1_Sat.log full=y direct=Y compress=N rows=Y; exit 0;;
When the same program kept in cron, it is not working.
IF I EXECUTE NORMAL COMMAND IN THE CRON WITH OUT SHELL THEY ARE WORKING WHEN I KEEP ANY SHELL PROGRAMS, THEY ARE NOT WORKING.
0 23 * * * /home/oracle/backup/backup.sh
The backup.log file is creating with 0 bytes.
Please help me in solving this problem.
it helps if you list the errors you get when it is run via cron.
most likly it is your env settings.
do a search on the boards for cron and env we get questions of this nature pretty offten.
|Thread Tools||Search this Thread|
|More UNIX and Linux Forum Topics You Might Find Helpful|
|Thread||Thread Starter||Forum||Replies||Last Post|
|Email program using CRON||countrydj||Red Hat||2||09-06-2011 08:07 PM|
|cron job and running program||TheTransporter||Shell Programming and Scripting||2||07-23-2011 01:06 PM|
|check mail backup cron job||timgolding||Shell Programming and Scripting||1||02-28-2011 11:45 AM|
|UNIX Backup program question||MayDHorseBwithU||UNIX for Dummies Questions & Answers||1||11-06-2005 06:45 AM|