LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-11-2008, 05:59 PM   #1
dannemil
LQ Newbie
 
Registered: Nov 2007
Posts: 5

Rep: Reputation: 0
why won't my crontab execute the commands?


I created a crontab file mycron, and reloaded it with

crontab mycron

If I include my username in the file as I thought I was supposed to do, it will not execute the command. Here is an example.

# m h dom mon dow user command
30 8 * * * dannemil /home/dannemil/command_files/infect-check.sh >> /home/dannemil/Desktop/infect-check/cron.log

cron runs as scheduled because it creates the log file as in the redirection above, but there is nothing in the log file, and the command to execute the sh file does not do what it is supposed to do.

BUT --- when I remove my username from the line like this

# m h dom mon dow user command
30 8 * * * /home/dannemil/command_files/infect-check.sh >> /home/dannemil/Desktop/infect-check/cron.log

then it executes just fine. I thought I was supposed to include my username on the line; at least that is what I read in the crontab man.

Could someone explain to me what I am doing wrong (although I know I should just shut up and let it go because it works without my username, so it is doing what I want it to do, but I sure would like to know why.)

Thanks.
 
Old 02-11-2008, 06:18 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
What distro are you using, and who told you to include a username?
Does the man-page you read match the cron you have installed?


Cheers,
Tink



Cheers,
Tink
 
Old 02-11-2008, 06:35 PM   #3
rtspitz
Member
 
Registered: Jan 2005
Location: germany
Distribution: suse, opensuse, debian, others for testing
Posts: 307

Rep: Reputation: 32
if you did this as an ordinary user with "crontab -e" this should be normal. all commands will be run with your user permissions. only root can run commands as a different user (I'm just ignoring sudo here).

--> just /etc/crontab (system's crontab) and files in /etc/cron.d accept the "user" field
 
Old 02-11-2008, 07:39 PM   #4
mjchin
LQ Newbie
 
Registered: Dec 2007
Posts: 11

Rep: Reputation: 0
I have centos 4.5 and don't use a user name on the command line; executes just fine with path / command
 
Old 02-12-2008, 06:25 PM   #5
dannemil
LQ Newbie
 
Registered: Nov 2007
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Tinkster View Post
What distro are you using, and who told you to include a username?
Does the man-page you read match the cron you have installed?


Cheers,
Tink



Cheers,
Tink
I am using Ubuntu 7.10. I think I just misinterpreted what I read about crontab because it is working fine without my username as a parameter in the table.

Thanks
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Script doesn't execute in crontab jis0501 Linux - General 2 08-04-2007 08:09 AM
crontab : why root can't execute ?? bluenectar Linux - General 2 03-12-2007 04:21 AM
crontab execute consecutively SofNine Fedora 17 07-28-2006 02:34 PM
crontab entries will not execute when not logged fatra2 Linux - Software 2 05-23-2006 03:22 AM
Problem when using crontab to execute a .php file doublesheep Linux - General 3 06-10-2004 09:46 AM


All times are GMT -5. The time now is 05:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration