- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Running a command via cron vs manual
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
04-23-2001 11:04 AM
04-23-2001 11:04 AM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2001 11:11 AM
04-23-2001 11:11 AM
Re: Running a command via cron vs manual
set and export PATH and any other variables you might need. (e.g. SHLIB_PATH, ORACLE_HOME,
ORACLE_SID, etc.) Typically all you need is PATH.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2001 11:42 AM
04-23-2001 11:42 AM
SolutionThe environment which is provided to cron does not include the environmental variables you have when you have logged-in (for instance) and therefore sourced your $HOME profile.
Environmental variables can be embedded in your script as necessary, or they can be specified and exported or file-sourced in a crontab entry in one of the following ways:
0 1 * * * (V=x;export V;/home/my/script)
0 1 * * * (. /home/my/.env /home/my/script)
0 1 * * * su -c
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2001 12:50 PM
04-23-2001 12:50 PM
Re: Running a command via cron vs manual
PATH=/usr/bin:/usr/sbin:/sbin:/usr/omni/bin:/opt/omni/bin:/usr/local/bin
Is this what you are refering to and if so, can you please indicate why this is necessary. I have certain scripts currently in cron that work to succession without this type of entry. Thanks again gentlemen!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2001 01:10 PM
04-23-2001 01:10 PM
Re: Running a command via cron vs manual
couple of lines much like this to your script:
PATH=/usr/bin:/usr/local/bin:/opt/omni/bin
export PATH
You may need other directories as well depending on where the executables are located.
You can get a clear idea of what is going on by creating a small script, 'my.sh'.
#!/usr/bin/sh
echo "Path = ${PATH}" > /tmp/path.txt
chmod 755 my.sh
Execute my.sh from the shell and examine /tmp/path.txt.
Next create a crontab entry to execute my.sh
and examine /tmp/path.txt again. I think that you will find that the PATH's are vastly different.
Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2001 01:28 PM
04-23-2001 01:28 PM