• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 343
  • Last Modified:

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)?  
 
0
tzahi
Asked:
tzahi
1 Solution
 
arthurdCommented:
Use chmod in your perl program:

chmod (0777,"DIRECTORY");


0
 
Brian UtterbackPrinciple Software EngineerCommented:
In the perl script, before creating the new directories,
use the umask function.

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

0
 
tzahiAuthor Commented:
But why there is difference between  running it from crontab and from command line  as root
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now