Link to home
Start Free TrialLog in
Avatar of tzahi
tzahi

asked on

mkdir from perl script using crontab create limited permissions.

I am using perl script that remove directory and create another with the same name and the same path.

When running this script as root manually it is creating directory which is owned by root with permissins (777)when this script is running by crontab it is creating  directory which is owned by root with permissins (771)when this script is running by crontab it is creating .

 what should i do in order to run it from crontab but create with permissions(777)?  
 
ASKER CERTIFIED SOLUTION
Avatar of arthurd
arthurd

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 Brian Utterback
In the perl script, before creating the new directories,
use the umask function.

umask(0);
mkdir "directorytocreate", 0777;

Avatar of tzahi
tzahi

ASKER

But why there is difference between  running it from crontab and from command line  as root