Solved

Crontab problem...

Posted on 2008-10-29
6
637 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 6

Author Comment

by:My name is Mud
ID: 22838652
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
ID: 22838656
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
ID: 22839019
You need to set the umask, eg:

03 00 * * * umask 002 ;  /home/user/bin/webcamstart
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 40

Assisted Solution

by:omarfarid
omarfarid earned 25 total points
ID: 22841257
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
ID: 22841722
Don't set umask in crontab.  Set permissions in the script.
0
 
LVL 6

Author Closing Comment

by:My name is Mud
ID: 31511562
Thanks to both...
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Fine Tune your automatic Updates for Ubuntu / Debian
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

739 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