Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

crontab problem 1

Status
Not open for further replies.

sixtoedsloth

IS-IT--Management
Jan 1, 2002
118
GB
HI,

[sco 5.0.5]

i have a script in crontab that backs up files to a cpio archive, then runs a job to ftp them over a vpn to a redhat9 server.

when i run the job manually as root it works fine
but when crontab runs it, it creates the file but doesnt
ftp it. i have added a line to ping the remote box before i send it, which should help the vpn to build before the
files are sent. and i can watch the vpn build but no data
comes over, any ideas where i should be looking, logfiles,
or little gems of info that i may have missed would be much appreciated!


Cheers

Russ
 
A posting of the script contents may help.

If you are not specifically redirecting anything to log files, they should appear in root's mailbox.

Annihilannic.
 
Runs fine manually but fails under crontab raises the crontab patch error flag.
Don't know if it applies, but there is a crontab patch for .5 and .6. I also don't have the patch number handy.

Ed Fair
Any advice I give is my best judgement based on my interpretation of the facts you supply. Help increase my knowledge by providing some feedback, good or bad, on any advice I have given.
 
the scripts are as follows


# crontab
find pfx -name "*.tag" -print > /u4/bakup/fmabak.txt
find pfx -name "*.dat" -print >> /u4/bakup/fmabak.txt
cat /u4/bakup/fmabak.txt | cpio -ocvB -O /u4/bakup/fmabak.cpo
cd /u4/bakup
compress -fqH fmabak.cpo
/usr/bin/hcs/sendhcsbak



#sendhcsbak
ping -c5 192.168.200.7 &> null # lift line
rcftp 192.168.200.7 fatstock fatstock /u4/fmabak.cpo

#rcftp
ftp -inv <<!
open $1
user $2 $3
binary
mput $4
quit

 
Is that a script called crontab or the actual contents of the crontab for that user?

If it's the actual crontab, it's missing the scheduling values, for example:

[tt]# minute hour monthday month weekday comands ...
30 13 * * * 0 /path/to/your/script[/tt]

man crontab for details.

Annihilannic.
 
nah, sorry, its my crappy cut & paste!

thats the sript that is run from crontab!
it does actually run, because i get the cpio file
its just the ftp bit that doesnt run

russ
 
Jobs run by cron have a fairly restricted default path of /bin:/usr/bin:. Are you sure rcftp is in that path? If not, try specifying its full name.

It may also be a good idea to put shebang lines at the beginning of your scripts so you're sure they're running in the correct shell, e.g.:

[tt]#!/bin/sh
find pfx -name &quot;*.tag&quot; -print > /u4/bakup/fmabak.txt
...[/tt]

Annihilannic.
 
Cheers Annihilannic,

im not sure if its the #!/bin/sh
or the full path name, but it works

you are a star, have a star

Russ
 
cheers, the combination of both the #!/bin/sh and the fuly specified path seems to have worked have a star!

Russ

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top