Backup with shell program and cron job. | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Backup with shell program and cron job.

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 03-11-2004
jarkvarma jarkvarma is offline
Registered User
 
Join Date: Nov 2001
Last Activity: 28 June 2005, 4:25 AM EDT
Location: HYDERABAD,INDIA
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Backup with shell program and cron job.

Hi,

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.

#!/bin/sh
#script to take backup on day basis, This is going to run from cron job.
#
while :
do
clear
yourch=`date +%u`
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;;
esac
done

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
> /home/oracle/backup/backup.log

The backup.log file is creating with 0 bytes.

Please help me in solving this problem.

With Regards
Varma.
Sponsored Links
    #2  
Old 03-11-2004
Optimus_P Optimus_P is offline Forum Advisor  
flim flam flamma jamma
 
Join Date: May 2001
Last Activity: 24 March 2008, 9:43 PM EDT
Location: Chicago IL, USA
Posts: 1,006
Thanks: 0
Thanked 2 Times in 1 Post
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.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 07:07 PM
cron job and running program TheTransporter Shell Programming and Scripting 2 07-23-2011 12:06 PM
check mail backup cron job timgolding Shell Programming and Scripting 1 02-28-2011 10:45 AM
UNIX Backup program question MayDHorseBwithU UNIX for Dummies Questions & Answers 1 11-06-2005 05:45 AM



All times are GMT -4. The time now is 11:49 PM.