- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Script running in shell, not in cron
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
тАО10-03-2008 07:06 AM
тАО10-03-2008 07:06 AM
Script running in shell, not in cron
Is there a way to run .profile file to read all the environment variables and execute a script in the same crontab line?
I run my shell fine in a ssh session, when a i run it from a cron , it does not run due to variables not assigned. I would preferto to read the .profile instead off add all the variables in each script. Thanks all!
- Tags:
- cron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-03-2008 07:25 AM
тАО10-03-2008 07:25 AM
Re: Script running in shell, not in cron
. /path/to/.profile ; /path/to/script
in your crontab command.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-03-2008 08:32 AM
тАО10-03-2008 08:32 AM
Re: Script running in shell, not in cron
additionally to sourcing, you should check the profile for commands like who, stty, ... which require the existence of a valid tty.
...
if [ -t 1 ]
then stty kill ^K ...
fi
...
mfG Peter
- Tags:
- stty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-03-2008 09:29 AM
тАО10-03-2008 09:29 AM
Re: Script running in shell, not in cron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-06-2008 01:06 AM
тАО10-06-2008 01:06 AM
Re: Script running in shell, not in cron
#!/bin/sh
. /path/to/.profile
This will include the .profile and all the definitions in it (it's the "." that does it). This way if you change your .profile all your scripts will also recieve the changes :)
Just remember the space between "." and "/path". "./path" is not the same as ". /path".
Best regards
Fredrik Eriksson