- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: script run ok manually but failed when run as ...
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
Discussions
Discussions
Forums
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
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
тАО12-16-2009 10:38 PM
тАО12-16-2009 10:38 PM
script run ok manually but failed when run as a cronjob
I write the script,ftp_stats.sh below
#!/usr/bin/ksh
/usr/bin/ftp -i -n < ftp_stats.txt
-------------------------------------------
ftp_stats.txt is as follows
open IPaddress
user id password
cd dataload
put stats.log
The objective is to run the job as a cron successfully.
Please advice.
Regards
Feng Lin
Please advice.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-16-2009 10:44 PM
тАО12-16-2009 10:44 PM
Re: script run ok manually but failed when run as a cronjob
How do you run the script manually?
Because the script contains "cd" command, I guess that might be a issue.
The script containing "cd" have to be run bit differently as far as I know.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-16-2009 10:47 PM
тАО12-16-2009 10:47 PM
Re: script run ok manually but failed when run as a cronjob
could you send the line from crontab ??
mikap
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-16-2009 10:47 PM
тАО12-16-2009 10:47 PM
Re: script run ok manually but failed when run as a cronjob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-16-2009 11:24 PM
тАО12-16-2009 11:24 PM
Re: script run ok manually but failed when run as a cronjob
34 12 * * 1-5 /root/ftp_nspay_stats.sh > /dev/null 2>&1
cron.log shows
CMD: /root/ftp_stats.sh > /dev/null 2>&1
> root 18598 c Thu Dec 17 12:34:00 SST 2009
Regards
Feng Lin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-16-2009 11:27 PM
тАО12-16-2009 11:27 PM
Re: script run ok manually but failed when run as a cronjob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-16-2009 11:36 PM
тАО12-16-2009 11:36 PM
Re: script run ok manually but failed when run as a cronjob
also make sure you have rwx -permissions ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-16-2009 11:39 PM
тАО12-16-2009 11:39 PM
Re: script run ok manually but failed when run as a cronjob
you could define a dhell before the sh script in the cron.
/usr/bin/ksh /path_to_the_scrit.sh
mikap
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-17-2009 12:25 AM
тАО12-17-2009 12:25 AM
Re: script run ok manually but failed when run as a cronjob
The error message is
Connected to IP address.
220 IP address FTP server (Revision 1.1 Version wuftpd-2.6.1(PHNE_36065) Mon Apr 14 06:17:08 GMT 2008) ready.
Remote system type is UNIX.
Using binary mode to transfer files.
331 Password required for email.
230 User email logged in.
250 CWD command successful.
nspay_stats.log: No such file or directory
221-You have transferred 0 bytes in 0 files.
221-Total traffic for this session was 341 bytes in 0 transfers.
221-Thank you for using the FTP service on IP address.
221 Goodbye.
Any resolution? Please note that when I run manually, it works fine.
Regards
Feng Lin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-17-2009 12:28 AM
тАО12-17-2009 12:28 AM
Re: script run ok manually but failed when run as a cronjob
Most likely the script is not being run from the directory you think it io. You can confirm that by executing "pwd" at the top of the script. If that's the problem, just add "cd /some/dir" before the ftp command. (Where "/some/dir" is the location of nspay_stats.log.)