[opensuse] Ftp cron job stopped working
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! -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 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... 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 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 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). 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. - -- ============================================================================== I have always wished that my computer would be as easy to use as my telephone. My wish has come true. I no longer know how to use my telephone. Bjarne Stroustrup ============================================================================== -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iD8DBQFGyAN+asN0sSnLmgIRAoLgAJ9nujaWfpYkmaqJd94yIdcepw2BgACgupsf fiU8PLWthIJT3wbMKnLC6ho= =ELjE -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
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: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Brandon Carl wrote:
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
<snio>
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?
The logs are normal kept in /var/log ... what is put where is usually defined by the syslog configuration file.. messages defaults to containings everything, warn contains warnings etc You do also have debugging switches on the ftp command that can be used to log ftp session interaction...
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?
Useful little function.... whereis <command name> at CLI this will list the location ftp is found in the path.
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.
Long time since I last tried this.. What was the problem?
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?
Extract from a backup script I use... DSTR="$(date +%g%m%d)" ...... ... JOBLABEL="${OPTARG}${DSTR}" ...... The JOBLABEL is used to define a filename ... After this you have a "how long is a piece of string" type of question....One method is to have a script creating the tars to create the files so they can be sorted to that the first filename returned is the most recent (it does not have to be by datestamp but it is a bit easier to manage)... But there is no "best" way of doing this... You might have also something more useful if you have the server script push the file to the workstation rather than the workstation pull it from the server... Having two processes collaborate without communication is at best tricky.
- -- Brandon
- -- ============================================================================== I have always wished that my computer would be as easy to use as my telephone. My wish has come true. I no longer know how to use my telephone. Bjarne Stroustrup ============================================================================== -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iD8DBQFGyVJ0asN0sSnLmgIRAp8dAKCN/cPkD/V8RNPZLJOOdFbJHiRlJACffTAC pjVuNQrEgIhxp9APY37YX9Y= =NTzB -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Saturday 18 August 2007 19:28:46 Brandon Carl wrote:
And, finally, the output of the cronjob that gets e-mailed to me: ftp: Name or service not known
This error message simply means that the host name lookup fails. Either you have misspelled the host name, or there is something wrong with the DNS -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (3)
-
Anders Johansson
-
Brandon Carl
-
G T Smith