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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FTP on cron: how to be silent except errors 1

Status
Not open for further replies.

OsakaWebbie

Programmer
Feb 11, 2003
628
0
0
JP
I made a cron script to do some backups and FTP them offsite. Everything is running fine, but I still get an email with "Interactive mode off." Here is the relevent part of my script:
Code:
ftp -n $REMOTESERVER <<INPUT_END
quote user $LOGIN
quote pass $PASSWORD
prompt off
put myfile1.tar.gz
put myfile1.tar.gz
exit
INPUT_END
I don't want to send the whole output to /dev/null or something, because I want to be notified if there are errors. But I also don't want this useless email every night. I tried just doing "prompt off > /dev/null", but it didn't shut it up. Suggestions?
 
you could try just rerouteing stdout

ftp -n $REMOTESERVER 1>/dev/nul <<INPUT_END

if it is stderr you need to reroute then use 2> instead.


A Maintenance contract is essential, not a Luxury.
Do things on the cheap & it will cost you dear
 
Thanks! I was forgetting that STDOUT and STDERR are separate, and I didn't realize that I needed to do the redirect for the whole ftp command, not the commands inside that (which are not commands to the shell but to ftp).

Aside: For the sake of future readers, the spelling seems to be null, not nul, and the 1 is technically optional (STDOUT is the default).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top