Solved

Crontab problem...

Posted on 2008-10-29
6
626 Views
Last Modified: 2013-12-16
I don't know how to start... don't know why is happening... but here it goes...


I have set up webcam on linux, and I wanted to automate the process, so I found a page with two files one to stop the webcam and the other to start it, to be on the safe side it should be run at midnight pss some minutes.. using crontab...

ok if I run the program from the console, the images are created with 664 permissions wich that's what I want and it should be, since the program is executed by the user and it is in the user bin folder /home/user/bin and images are stored in a user's folder /home/user/pics

but if I set up cron...

crontab -u user -e

<vars>
<whatever>
<path add path to bin's user> {either this or...}

* * * * * /home/user/bin/webcamstart {this is the same I think and both are declared}


Why cron thinks like the executor is root??? or why does it change it from 664 to 644???


I  hope I made my self clear...
0
Comment
Question by:My name is Mud
6 Comments
 
LVL 6

Author Comment

by:My name is Mud
Comment Utility
Oh forgot to mention that I didn't knew the /etc/crontab fileshouldn't be edited manually, which I did and put something like


* * * * * user /home/user/bin/webcamstart



This is the real cronfile for user...
SHELL=/bin/sh
HOME=/home/user
PATH=/usr/bin:/bin:/home/user/bin
LOGNAME=user
USER=user

02 00 * * * /home/user/bin/webcamstop
03 00 * * * /home/user/bin/webcamstart
06 00 * * * /home/user/bin/mkmovie
* * * * * /home/user/bin/createmask

Webcamstart starts the webcam and all images are 644 instead of 664 as well as mkmovie which starts the mencoder to create a movie out of the files from yesterday folder... and again, movie is 644 instead of 664... so what am I doing wrong???
0
 
LVL 6

Author Comment

by:My name is Mud
Comment Utility
oh and puting manually the comands in crontab did work with the same results as root...
0
 
LVL 48

Accepted Solution

by:
Tintin earned 100 total points
Comment Utility
You need to set the umask, eg:

03 00 * * * umask 002 ;  /home/user/bin/webcamstart
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 40

Assisted Solution

by:omarfarid
omarfarid earned 25 total points
Comment Utility
As Tintin recommended, it is because of the umask of the process that runs the command. I think in your user profile you are setting umask to 002 while when crontab is run it uses the default umask of 022
0
 
LVL 8

Expert Comment

by:eager
Comment Utility
Don't set umask in crontab.  Set permissions in the script.
0
 
LVL 6

Author Closing Comment

by:My name is Mud
Comment Utility
Thanks to both...
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Daily system administration tasks often require administrators to connect remote systems. But allowing these remote systems to accept passwords makes these systems vulnerable to the risk of brute-force password guessing attacks. Furthermore there ar…
How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now