Link to home
Start Free TrialLog in
Avatar of LPTech
LPTech

asked on

umask for cron jobs

Hi,

I am running a RedHat 2.1AS Linux box and I need the default umask to be 002. I set it in /etc/profile and /home/user/.bash_profile for each user; however, when jobs are run by cron as root, the umask doesn't seem to be in effect. Is there any way to make the umask the correct value permanently without actually adding the commands into the scripts run by cron?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of liddler
liddler
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of LPTech
LPTech

ASKER

Great, thanks~!
Hi,

   What's your cron script? I assume that is a sh or bash script.
How about /etc/bashrc in addition to /etc/profile and /home/user/.bash_profile?

Wesly
Avatar of LPTech

ASKER

It's actually a perl script...
You could call a system command from perl -
system (umask 002);
Avatar of LPTech

ASKER

Yeah, I was hoping to not have to make a code change to the script due to source control\testing problems... Adding the umask 002 to the crontab works perfectly. =P