Brandon Carl wrote:
I'm running an opensuse 10.2 machine with a cron job that ftps to my webserver and downloads several backup files that are created four
times daily. Here is the content of the .sh file that runs:



#!/bin/sh
HOST='web170.ixwebhosting.com'
USER='*REMOVED*'
PASSWD='*REMOVED*'
ftp -n $HOST <<SCRIPT
user $USER $PASSWD
binary
lcd /home/spleeyah/wmbs/wmbs.spleeyah.com/backup/
cd/wmbs.spleeyah.com/backup/
prompt
mget *
quit
SCRIPT
exit 0

Basically what it does is connects to the ftp server, goes to the "backup" directory where there are several .tar.gz files, and
downloads them all.  I couldn't find a way to ftp just the new ones,
so I set it to download them all.  There are 548 files as of now, so
maybe that's not such a good idea now that I think about it.  Maybe
the itense bandwidth could kill my cronjob?  Backups on my webserver
are done 4 times a day, and this cronjob is 15 minutes after the
start of the webserver cron, which usually lasts about 2 minutes,
average.

Here is the contents of my crontab: 15 0,6,12,18 * * * sh
/home/spleeyah/sh/ftp_wmbs_database_backup.sh > /home/spleeyah/wmbs/wmbs.spleeyah.com/backup/ftp_mysql_backup.log

And, finally, the output of the cronjob that gets e-mailed to me: ftp: Name or service not known


So, I don't know what caused this to stop working, because it was working wonders before.

Thanks!

I dont know why your conjob has started failing but I would suggest
looking in the logs and also check whether the job runs standalone...

Which logs should I look at?
Looking at the script and the crontab definition the call to sh in the
crontab file is superfluous, it is implicitly called by the first line
of the script (so you are effectively loading two shells), sh links to
bash so changing /bin/sh to /bin/bash here might be worthwhile. One

Changed it to /bin/bash

possibility is the environment is not being passed to the script
therefore ftp is not being found, trying putting in the explicit path to
the ftp command in and see what happens, or modifying the crontab file

What is the explicit path to ftp?

so that it has a suitable path defined (see man crontab and man cron).

BTW The bit between the two SCRIPT definitions can be combined into a
single one line command (see man ftp).

Tried it, didn't work.

A common trick is incorporate
date stamp info into the filename (see man date), This latter the
identification of files by creation date possible when the datestamp
info is not directly available.

How would I put this into use?
- --
Brandon
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to