-----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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to