Solved

Crontab problem...

Posted on 2008-10-29
6
641 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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…
Suggested Courses

630 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