- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: crontab run error.
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
10-27-2005 04:18 PM
10-27-2005 04:18 PM
crontab run error.
I am set my cronjob to run a script, this script will generate a report file. If I run it by command line, it run ok, but I setup it to run by Cronjob. I generate a file with size =0. Please help me.
Many thanks,
NQV
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2005 04:24 PM
10-27-2005 04:24 PM
Re: crontab run error.
Check what ever variables you use are defined in script itself. Also use absolute paths for calling commands, storing files etc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2005 04:27 PM
10-27-2005 04:27 PM
Re: crontab run error.
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2005 04:46 PM
10-27-2005 04:46 PM
Re: crontab run error.
Regards,
Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2005 04:57 PM
10-27-2005 04:57 PM
Re: crontab run error.
> CMD: /usr/bin/ksh /tuxedo/cron/sers_rpt.sh
> tuxedo 23437 c Fri Oct 28 11:54:00 TST 2005
NQV
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2005 05:29 PM
10-28-2005 05:29 PM
Re: crontab run error.
If your job runs from the command line
do
env > file
evaulate the file, Edit your cron script. add and set the variable in your script. If you get all the variable set everything should run.
Rory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2005 08:11 PM
10-28-2005 08:11 PM
Re: crontab run error.
. ~/.profile
In the beginning of the script. This should resolve the problem.
Usually it's enough to restore only full PATH variable
Good Luck
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2005 07:58 PM
10-31-2005 07:58 PM
Re: crontab run error.
this is content of crontab
49 15 * * * /tuxedo/cron/sers_rpt.sh
Thanks.
NQV
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2005 08:52 PM
10-31-2005 08:52 PM
Re: crontab run error.
cron jobs have no environment.
Commonly the script works fine from the command line and fails in cron because the PATH variable is not set.
There are lots of ways to fix it.
You can manually set PATH in the script. You can run the root profile as Victor suggested.
Add this to the job.
set -x
Right after the shell statement at the top.
This should provide you provide you a lot of detail that should lead you to this conclusion: Read the prior suggestions carefully, try one and see that it resolves the problem.
Also for cron to run properly there must be some space in the var filesystem:
bdf /var
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2005 02:53 AM
11-01-2005 02:53 AM
Re: crontab run error.
I disagree with the analysis that it is just a PATH problem. (It could be) I also disagree with sourcing the .profile in cron scripts.
PATH can be just one of the Problems. Sourcing .profiles sometimes cause problems like "not a tty device". The issue is you need to set the all the environmental variables that your shell script requires. Before you execute the work portion of your script.
For example: Service ID's like ORACLE commonly has environmental variables set like ORAHOME and SID. These are usually set in your .profile. On CRON jobs you need to set all your variables in your shell script.
The .profile commonly sets TERM= by running some sort of tset command. You would not want to run tset via cron because you would receive tty errors.
To fix your problem EVAULATE all of your environment variables and set them in you cron script.
Good Luck