- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Umask for cron jobs
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
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
тАО05-17-2001 09:40 AM
тАО05-17-2001 09:40 AM
Umask for cron jobs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-17-2001 09:51 AM
тАО05-17-2001 09:51 AM
Re: Umask for cron jobs
Hp is telling you the truth. The environment for cron is intentionally very sparse. Not only will you need to set umask, but PATH and other environment variables as well.
One convention that you can use, if you have many common cronjobs is to include common settings in an external file and ". " to execute them at the beginning of every cron spawned script.
e.g.
ENV_STUFF=/usr/local/bin/cronenv.sh
if [ -r ${ENV_STUFF} ]
then
. ${ENV_STUFF}
fi
then /usr/local/bin/cronenv.sh might resemble this:
umask 027
PATH=/usr/bin:/opt/omni/bin:/opt/omni/lbin
USERVAR=goofy
export PATH USERVAR
# no exit statement
Regards, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-17-2001 10:02 AM
тАО05-17-2001 10:02 AM
Re: Umask for cron jobs
Clay's suggestion of an "include" file for sourcing (the dot/blank/filename syntax) is an excellent one.
In fact, it helps to avoid the very annoying "not a typewriter" message which invariably gets mailed whenever a cron job executes and sources its user's $HOME/.profile to obtain environmental varibles.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-17-2001 10:33 AM
тАО05-17-2001 10:33 AM
Re: Umask for cron jobs
Yes, HP is correct. The environment that cron supplies is very limited. The man page for crontab(1) shows what is supplied and mentions adding the .profile at the head of any cron scripts.
--Bruce
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-17-2001 11:29 AM
тАО05-17-2001 11:29 AM
Re: Umask for cron jobs
We use to run a "su" command to a user, fron de crontab.
su - oracle74 -c "${SCRIPT}/start_stop.sh BGDWH STOP"
The .profile of this user set the env.