- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Crontab problem - executing 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
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
тАО02-24-2005 11:27 PM
тАО02-24-2005 11:27 PM
Crontab problem - executing script
I have a script that I can execute manually with the command
./
But when i place it in the crontab (as user root)as the following;
30 12 * * * ./
it does not run.
1. Do I need ./ on the command in crontab?
2. I've looked at the crontab log and it reports it's being executed.
Am I missing something?
The script has permissions of 777 etc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2005 11:30 PM
тАО02-24-2005 11:30 PM
Re: Crontab problem - executing script
If you're running it manually from the directory that contains the script and the files it will work - but cron won't run it from that directory.
Mark Syder (like the drink but spelt different)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2005 11:33 PM
тАО02-24-2005 11:33 PM
Re: Crontab problem - executing script
You need to remember that cron provides a minimal environment. You need to explicitly specify paths, environement variables, etc. in your script in order for it to work properly. You could source a profile within your script to set all the variables and paths you need.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2005 11:36 PM
тАО02-24-2005 11:36 PM
Re: Crontab problem - executing script
Maybe a problem with the enviroment . The enviroment is different when running from cron. Do all necessary enfviroment settings in the beginning of the script.
Another hint, redirect the output and errors from the script to a file ( <script> >/tmp/log 2>&1 )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2005 11:37 PM
тАО02-24-2005 11:37 PM
Re: Crontab problem - executing script
You must re-create this environment with cron as .profile is not run.
You can either re-define these variables in the script or write a wrapper script that will initializes the variables and you can reuser for other cron jobs.
Regards
Jean-Luc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2005 11:37 PM
тАО02-24-2005 11:37 PM
Re: Crontab problem - executing script
./path/script
but instead:
/absolute_path/script
the cron log is saying that cron started to run your job, not that it completed it (which it didn't as it couldn't find the command?).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2005 11:37 PM
тАО02-24-2005 11:37 PM
Re: Crontab problem - executing script
you should always enter the full path to the script in crontab. If your log says that a script (whose path started with a dot) was executed, it is probably true, but it was apparently not the script you expected it to be!
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-25-2005 01:19 AM
тАО02-25-2005 01:19 AM
Re: Crontab problem - executing script
The script is owned by root, I've edited root's crontab, and the script contains the full path.
Not sure about environmental variables?
is this the value of PATH?
Chadders
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-25-2005 01:27 AM
тАО02-25-2005 01:27 AM
Re: Crontab problem - executing script
PATH is one enviroment variable, there should be several other. Check the loginfiles for the user (.login or .profile depending on shell). There may also be enviroment settings in .dtprofile and .cshrc and, perhaps other source files.
Try my idea with redirecting output to a file and you will get an idea about what is missing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-25-2005 02:01 AM
тАО02-25-2005 02:01 AM
Re: Crontab problem - executing script
With 777 permissions, there is nothing to stop a disgruntled employee editing this script to do anything they like
e.g.
rm -rf /*