Crontab Issue

Thread Tools Search this Thread
# 1  
Crontab Issue

I have a backup script that is suppose to run every night of the week, but it never does, it starts to run. The way I can tell is that the dates on dump_log are changing to when the script runs. If I look in the cron log file is shows
! > root 506342 cr /etc/back_up Fri Aug 5 10:30:00 2005
! < root 506342 cr /etc/back_up rc=2 Fri Aug 5 10:30:00 2005

I have not been able to find anything except if cron exits with 0 it was successful and if >0 it was unsuccessful. Also if I just run the script manually ./etc/back_up it works fine. Any thoughts? Thanks
# 2  
cron scripts do not have much of an environment - PATH etc may not be defined.

Assume that all references to things like "echo", if they are not shell builtins, must have a path - "/usr/bin/echo" or whatever. Plus, you have to shebang (#!/bin/ksh) on the first line of the script to get the shell you want - korn, etc. Otherwise you will get sh, your system's version of the Bourne shell.
# 3  
I looked at the env. and it seems to me that every thing is in the PATH, This is a new box, and I checked out the old box and everything seems to be the same. Here is the path and the script, It does work fine if you run it manually. It seems like it is choking on the /sbin/dump 0fsu /dev/ntape/tape0 1000000 /dev/disk/dsk0a >>&/etc/dump_log because first it never writes to the file and if I do a ps -ef | grep dump after the scheduled time nothing shows up.


#! /bin/csh
# /etc/back_up 7-25-05
# Use restore -ivf /dev/tape/tape0_db0 -s x (x = volume to be restored from)
# for file by file restores.
# Remember to rewind tape between restores when restoring different
# filesystems(volumes).
# Also, check fs using df to make sure tape does not fill up.
# Check /etc/backup_date for start and stop times and
# /etc/dump_log for play by play dump status info
echo > /etc/backup_date
echo > /etc/dump_log
echo starting full backup at `date` >> /etc/backup_date
echo starting dump of: / filesystem at `date` >> /etc/backup_date
/sbin/dump 0fsu /dev/ntape/tape0 1000000 /dev/disk/dsk0a >>&/etc/dump_log
echo dump of: / finished at `date` >> /etc/backup_date
echo starting dump of: /usr filesystem `date` >> /etc/backup_date
/sbin/dump 0fsu /dev/ntape/tape0 1000000 /dev/disk/dsk0g >>&/etc/dump_log
echo dump of: /usr finished at `date` >> /etc/backup_date
echo starting dump of: /db1 filesystem `date` >> /etc/backup_date
/sbin/dump 0fsu /dev/ntape/tape0 1000000 /dev/disk/dsk1b >>&/etc/dump_log
echo dump of: /db1 finished at `date` >> /etc/backup_date
echo starting dump of: /db2 filesystem `date` >> /etc/backup_date
/sbin/dump 0fsu /dev/ntape/tape0 1000000 /dev/disk/dsk2b >>&/etc/dump_log
echo dump of: /db2 finished at `date` >> /etc/backup_date
echo starting dump of: /db3 filesystem `date` >> /etc/backup_date
/sbin/dump 0fsu /dev/ntape/tape0 1000000 /dev/disk/dsk3b >>&/etc/dump_log
echo dump of: /db3 finished at `date` >> /etc/backup_date
echo starting dump of: /unidata filesystem `date` >> /etc/backup_date
/sbin/dump 0fsu /dev/ntape/tape0 1000000 /dev/disk/dsk4b >>&/etc/dump_log
echo dump of: /unidata finished at `date` >> /etc/backup_date
# Notify sytems administrators
mailx -s "dump done: admin4" < /etc/dumpdates

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Another issue with crontab

My shell script #!/bin/sh ORACLE_HOME=/var/opt/oracle/product/10g; export ORACLE_HOME PATH=$PATH:$ORACLE_HOME/bin:/bin:/usr/bin; export PATH today=`date "+%m-%d-%Y %H:%M:%S"`; export today CUR_DIR=$1; export CUR_DIR LOG_FILE=$CUR_DIR/error.log; export LOG_FILE # Direct... (30 Replies)
Discussion started by: rafa_fed2
30 Replies

2. UNIX for Dummies Questions & Answers

Crontab issue

Hello, I have a bash script that finds files older than 31 days and deletes them. I have this file loading into crontab to run everyday. It ran fine the first time i loaded it in, but now when I try to run it manually (bash I get errors. Here is the script TIME=" -maxdepth 1... (6 Replies)
Discussion started by: jrymer
6 Replies

3. UNIX for Advanced & Expert Users

Crontab Issue

My colleague who was a sysadmin , has created a cron job script which collects logs and process them. The script works perfectly as per the defined time set by him. it works when we keep the timing as 55 05 * * * , whereas if we try to prepone the cron task is not getting executed. Where... (10 Replies)
Discussion started by: aravindj80
10 Replies

4. Shell Programming and Scripting

Crontab issue

hi, i have schduled a job through crontab, but it is not getting executed. bash-3.2$ crontab -l # Monthly Download (mm hh DD MM format) 35 05 01 04 * /home/ftpsrp/srpftp1/download/ofrdb/scripts/ here is the permission of the .sh files -rwxr--r-- 1 ftpsrp srp ... (7 Replies)
Discussion started by: lovelysethii
7 Replies

5. Solaris

Crontab issue !

Guy's I'm facing problem with crontabe in Solaris10 and cron in crontab -e is not running but when I check /var/cron/log I found all the process running .. !! strange thing !! please your advice ... (1 Reply)
Discussion started by: top.level
1 Replies

6. UNIX for Advanced & Expert Users

Crontab issue

We have configured a script to be run at specific time using crontab. # crontab -l 15 11 * * * VM_Count_V4.shas per the crontab entry script should run every day 11.15 a.m Every time when the script is executed i get a mail but when i run it using crontab it doesn't send any mail. However... (1 Reply)
Discussion started by: pinga123
1 Replies

7. Shell Programming and Scripting

Issue with crontab

I have a ksh script which will connect to a database and executes some sql scripts. If i run the ksh script it is working fine. But if i schedule it to run at a perticular time using cron the sql script is not running. The scriptl initially creates a spool file for sql script and then connects and... (12 Replies)
Discussion started by: Sriranga
12 Replies

8. Shell Programming and Scripting

crontab issue

Hi Guys, I am having a prob with crontab.. When i enter "crontab -e", i am getting an message "History file has no read permission. " And my crontab is not executed (means the script is not called). What is the problem. can anybody help me.. Thanks for the help in advance.. ... (2 Replies)
Discussion started by: mac4rfree
2 Replies

9. UNIX for Advanced & Expert Users

crontab issue

I am adding a piece of code which adds entry in crontab ((in brown color)) \crontab -l > $tmpfile echo "Removing the cleanProcess entry if it already existed.." grep -v "" $tmpfile > $newtmpfile lcnt=`grep -c "" $tmpfile` echo... (4 Replies)
Discussion started by: crackthehit007
4 Replies

10. Solaris

crontab issue

Can someone help with a cron issue on a Sun Solaris 9 machine? The problem I am having is that one of my cron jobs is sending output to the /var/mail/root and I am trying to get it to stop. I have other cron jobs that are running that do not place any output to that location. They do however send... (6 Replies)
Discussion started by: Semper_Tempus
6 Replies

Featured Tech Videos