Sponsored Content
Top Forums Shell Programming and Scripting Backup with shell program and cron job. Post 48593 by jarkvarma on Thursday 11th of March 2004 02:48:46 AM
Old 03-11-2004
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.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

CRON-Job / Shell-Skript deleting special files

Just I'm trying to find script, which will do the following job: 1. as a CRON-Job it shoult a) delete files which will be either older than 24 hours or b) all files within a) a directory deleting recursive b) only a special directory. 2. write an error-/Delete_log... (9 Replies)
Discussion started by: ManfredWL
9 Replies

2. UNIX for Dummies Questions & Answers

shell script run by user or cron job ?

My shell script runs fine both as a cron job and when i issue it. However, I wish to differentiate when it runs as a cron-job so the "echo" statements are not issued (they get mailed to me, which i don't want). I tried checking $USER but since the cron was created in my user that does not... (5 Replies)
Discussion started by: sentinel
5 Replies

3. Shell Programming and Scripting

cron job - shell code correction

Hi I have a website that is having problem with cron jobs... I have a cron job set up to go to a page with this code... <? include('config.php'); if($_sys->bible_email_frequency == 'DAILY') { $u = new user(); $u->send_bible_email(); } ?> If i send my browser to this page... (2 Replies)
Discussion started by: whybelieve
2 Replies

4. Shell Programming and Scripting

Cron job shell script..

Hey Guys, i was trying out a shell script which has to remove a file for every 90 mins. this is the code i came up with . $ crontab -e file1 file1 contains 30 1 * * * * rm -r /folder1/folder2/somefile.txt Now i need the cron to run for every 90 mins. the problem with this is... (8 Replies)
Discussion started by: Irishboy24
8 Replies

5. Shell Programming and Scripting

check mail backup cron job

i have just installed a cron job to run at 3 in the morning once a week. It's difficult for me to test if it works because the email backup program takes the email service down before running the backup. I wondered if i could ask you gurus if this would work? 0 3 * * 0 ... (1 Reply)
Discussion started by: timgolding
1 Replies

6. Solaris

Shell Script gives error when run through cron job.

Hi, The following shell script runs without any problem when executed manulally. USED=$(df -h /arch | tail -1 | awk '{print $5}' | cut -d '%' -f 1) if then find /arch/AUBUAT/ -type f -mtime +0 | xargs rm find /arch/AUBMIG/ -type f -mtime +0 | xargs rm fi But the same gives below... (6 Replies)
Discussion started by: ksadiq79
6 Replies

7. UNIX for Dummies Questions & Answers

cron job for the created shell script

Hi am newbie for unix shell.. how to create a cron job for my already created shell script.:confused: Thanks! (1 Reply)
Discussion started by: vidhyaS
1 Replies

8. Shell Programming and Scripting

cron job and running program

Dear experts, I have this cronjob * */2 * * * $path/supervisor.sh The supervisor script is checking another script, which initializes the final scripts in multiple directories. Note that the supervisor script runs without the cronjob. In each directory, I have the following script: ... (2 Replies)
Discussion started by: TheTransporter
2 Replies

9. Shell Programming and Scripting

To refire a backup job using shell scripting..........

how to write a code using shell scripting to refire a back up job if it fails with an error code of 196? (7 Replies)
Discussion started by: Pawan Ramnani
7 Replies

10. Shell Programming and Scripting

CRON JOB not running - for tape backup from root user

I am trying a cron on root user to backup to tape using TAR command here is the cron entry 11 08 * * 6 /erdhot1cron 2>&1 >> /test3/scripts/dba/erdhot1cron.log here is script inside - edhot1cron #!/bin/bash vsysdt=`date +%d%m%y` date tar -cvf /dev/st0... (4 Replies)
Discussion started by: vijaymec50
4 Replies
JSONBOT(1)							    jsb manual								JSONBOT(1)

NAME
jsb-backup - The JSONBOT backup app SYNOPSIS
jsb-backup is used to make backup of the datadir used by JSONBOT DESCRIPTION
jsb-backup does a backup of the JSONBOT datadir (defaults to ~/.jsb) to ~/jsb-backups directory. USAGE
Usage: jsb-backup [options] Options: --version show program's version number and exit -h, --help show this help message and exit -d DATADIR, --datadir=DATADIR datadir to use -t TARGET, --target=TARGET target dir -l LOGLEVEL, --loglevel=LOGLEVEL logging level --colors enable the use of colors DOCUMENTATION
See http://jsonbot.org for more documentation or see http://jsonbot.googlecode.com SEE ALSO
jsb(1), jsb-init(1), jsb-irc(1), jsb-fleet(1), jsb-sed(1), jsb-tornado(1), jsb-xmpp(1), jsb-stop(1), jsb-udp(1), jsonbot(10 AUTHOR
This manual page was written by Bart Thate <bthate@gmail.com>, for the Debian GNU/Linux system (but may be used by others). Debian GNU/Linux 22 Nov 2011 JSONBOT(1)
All times are GMT -4. The time now is 09:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy