- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Cron can't executes the ftp script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2008 01:11 PM
02-08-2008 01:11 PM
Cron can't executes the ftp script
I am trying to run an ftp job in root cron and I can see in the log it executes but script not doing the job.
Below is the script and cron log too
#!/usr/bin/ksh
HOST='ftp.abc.com'
USER='abcftp'
PASSWD='nzm6hxip'
/usr/bin/ftp -ni $HOST <
quote PASS $PASSWD
bin
cd /tpadepot
put RECON_AMIC_20080207.DAT
quit
END_SCRIPT
exit 0
abc1:/var/spool/cron/crontabs #cd /var/adm/cron
abc1:/var/adm/cron #tail -f log
< root 17793 c Fri Feb 8 15:25:05 EST 2008
> CMD: /cl-01/apps/wcis/wcisclon/output/ftpjob.ksh > /dev/null 2>&1
> root 18317 c Fri Feb 8 15:27:00 EST 2008
< root 18317 c Fri Feb 8 15:27:05 EST 2008
> CMD: /scripts/CLEAN_VAR_TMP > /dev/null 2>&1
> root 19454 c Fri Feb 8 15:35:00 EST 2008
< root 19454 c Fri Feb 8 15:35:00 EST 2008 rc=126
> CMD: /cl-01/apps/wcis/wcisclon/output/ftpjob.ksh
> root 22028 c Fri Feb 8 15:55:00 EST 2008
< root 22028 c Fri Feb 8 15:55:05 EST 2008
Any one has a idea.
Thx!
Ashan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2008 01:31 PM
02-08-2008 01:31 PM
Re: Cron can't executes the ftp script
machine ServerName
login UserName
password Password
macdef init
lcd /some/local/path
cd /some/remote/path
put localfile remotefile
quit
then in cron
00 01 * * * /usr/bin/ftp Servername > /dev/null 2>&1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2008 01:35 PM
02-08-2008 01:35 PM
Re: Cron can't executes the ftp script
switches on verbose ftp messages and
logs the output to a file.
from what you've given, it could be anything.
ftp -v -niv 2>&1 > /logfile <<-END
.
.
.
END
or in the crontab entry, something like
your_command 2>&1 > /logfile
then examine logfile
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2008 05:48 PM
02-08-2008 05:48 PM
Re: Cron can't executes the ftp script
Typically you use:
ftp -ni $HOST <
...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2008 09:11 AM
02-09-2008 09:11 AM
Re: Cron can't executes the ftp script
> #!/usr/bin/ksh
> HOST='ftp.abc.com'
> USER='abcftp'
> PASSWD='nzm6hxip'
Using apostrophes is not necessary as there are no special characters in the string.
> /usr/bin/ftp -ni $HOST <
> quote PASS $PASSWD
Using quote in this context is not necessary or even recommended. Put everything on a single line:
USER $USER $PASSWD
> bin
> cd /tpadepot
> put RECON_AMIC_20080207.DAT
There is the likely problem. You issued a remote cd command but never issued a local lcd command. Therefore, your current working directory is your $HOME directory (see man crontab). Always use lcd. And when running anything in cron, always use a logfile with -v options to any commands in your cron jobs.
Bill Hassell, sysadmin