[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

mkdir from perl script using crontab create limited permissions.

Posted on 1998-11-18
3
Medium Priority
?
341 Views
Last Modified: 2013-12-23
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
Comment
Question by:tzahi
3 Comments
 
LVL 1

Accepted Solution

by:
arthurd earned 200 total points
ID: 1582621
Use chmod in your perl program:

chmod (0777,"DIRECTORY");


0
 
LVL 22

Expert Comment

by:Brian Utterback
ID: 1582622
In the perl script, before creating the new directories,
use the umask function.

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

0
 

Author Comment

by:tzahi
ID: 1582623
But why there is difference between  running it from crontab and from command line  as root
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

During and after that shift to cloud, one area that still poses a struggle for many organizations is what to do with their department file shares.
How to fix a SonicWall Gateway Anti-Virus firewall blocking automatic updates to apps like Windows, Adobe, Symantec, etc.
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question