- Community Home
- >
- Servers and Operating Systems
- >
- Operating System - HP-UX
- >
- System Administration
- >
- script run ok manually but failed when run as a cr...
-
-
Categories
- Topics
- Hybrid IT with Cloud
- Mobile & IoT
- IT for Data & Analytics
- Transformation
- Strategy and Technology
- Products
- Cloud
- Integrated Systems
- Networking
- Servers and Operating Systems
- Services
- Storage
- Company
- Events
- Partner Solutions and Certifications
- Welcome
- Welcome
- Announcements
- Tips and Tricks
- Feedback
-
Blogs
- Alliances
- Around the Storage Block
- Behind the scenes @ Labs
- Converged Data Center Infrastructure
- Digital Transformation
- Grounded in the Cloud
- HPE Careers
- HPE Storage Tech Insiders
- Infrastructure Insights
- Inspiring Progress
- Internet of Things (IoT)
- My Learning Certification
- Networking
- OEM Solutions
- Servers: The Right Compute
- Telecom IQ
- Transforming IT
-
Quick Links
- Community
- Getting Started
- FAQ
- Ranking Overview
- Rules of Participation
- Contact
- Email us
- Tell us what you think
- Information Libraries
- Integrated Systems
- Networking
- Servers
- Storage
- Other HPE Sites
- Support Center
- Enterprise.nxt
- Marketplace
- Aruba Airheads Community
-
Categories
-
Forums
-
Blogs
-
InformationEnglish
script run ok manually but failed when run as a cronjob
- 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
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- 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
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
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- 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
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
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- 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
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
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- 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
Re: script run ok manually but failed when run as a cronjob
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- 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
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
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- 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
Re: script run ok manually but failed when run as a cronjob
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- 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
Re: script run ok manually but failed when run as a cronjob
also make sure you have rwx -permissions ?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- 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
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
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- 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
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
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- 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
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.)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
12-17-2009 12:34 AM
12-17-2009 12:34 AM
Re: script run ok manually but failed when run as a cronjob
Re: script run ok manually but failed when run as a cronjob
where is your ftp_stats.txt file or is dataload is correct? or what is the absolute path of stats.log?
put all absolute file path and check.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
12-17-2009 12:35 AM
12-17-2009 12:35 AM
Re: script run ok manually but failed when run as a cronjob
Re: script run ok manually but failed when run as a cronjob
define the full path from /.../.../stats.log,
in you script.
mikap
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
12-17-2009 12:36 AM
12-17-2009 12:36 AM
Re: script run ok manually but failed when run as a cronjob
Re: script run ok manually but failed when run as a cronjob
full path = absolute path.
mikap
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
12-17-2009 01:07 AM
12-17-2009 01:07 AM
Re: script run ok manually but failed when run as a cronjob
Re: script run ok manually but failed when run as a cronjob
Thanks for your reply. My problem is solved.
Cheers
Feng Lin
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
12-20-2009 01:00 AM
12-20-2009 01:00 AM
Re: script run ok manually but failed when run as a cronjob
Re: script run ok manually but failed when run as a cronjob
You can now assign points to participants and close the thread. This might help you to get answer in prompt.
Hewlett Packard Enterprise International
- Communities
- HPE Blogs and Forum
© Copyright 2018 Hewlett Packard Enterprise Development LP