Results 1 to 10 of 11
I have 2 cron job on is
crontab -e
0 0 * * * avast-update
0 12 * * * avast-update
this above one works the one below not at ...
- 04-30-2010 #1Linux Newbie
- Join Date
- Jan 2010
- Location
- usa
- Posts
- 124
help with crontab please
I have 2 cron job on is
crontab -e
0 0 * * * avast-update
0 12 * * * avast-update
this above one works the one below not at all
sudo crontab -e
0 3 * * * apt-get update & apt-get dist-upgrade
0 15 * * * apt-get update & apt-get dist-upgrade
i have even restrated my computer after i have saved the crontab. anyone have any idea why my jobs are not running? I'm new to this.
- 04-30-2010 #2Linux User
- Join Date
- Nov 2009
- Location
- France
- Posts
- 292
orCode:0 15 * * * apt-get update && apt-get dist-upgrade
From bash man pagesCode:0 15 * * * apt-get update ; apt-get dist-upgrade
It seems & must be a terminating control operator.If a command is terminated by the control operator &, the shell executes the command in the background in a subshell. The shell does not wait for the command to finish, and the return status is 0. Commands separated by a ; are executed sequentially; the shell waits for each command to terminate in turn. The return status is the exit status of the last command executed.
Just try in a terminal :
I didn't try the above with cron.Code:ls & ls & free ls && free ls ; free
0 + 1 = 1 != 2 <> 3 != 4 ...
Until the camel can pass though the eye of the needle.
- 05-02-2010 #3Linux Newbie
- Join Date
- Jan 2010
- Location
- usa
- Posts
- 124
im still having trouble getting this to work. my file says that it is saved into some place called /tmp/crontab. but when i go to see if their is a file in /tmp/.crontab i see nothing and my cron jobs do not work
sudo crontab -e
0 3 * * * apt-get update && apt-get dist-upgrade -y
0 15 * * * apt-get update && apt-get dist-upgrade -y
even if i do
sudo crontab -e
0 3 * * * apt-get update ; apt-get dist-upgrade -y
0 15 * * * apt-get update ; apt-get dist-upgrade -y
- 05-02-2010 #4Linux User
- Join Date
- Nov 2009
- Location
- France
- Posts
- 292
Either specify the full path to your programs or define the PATH variable at the beginning of the cron job. You'll perhaps have to define the SHELL variable too. The cron job is found in /var/spool/cron, but you don't have to worry about that.
Code:PATH="/bin:/usr/bin:/usr/local/bin" #JUST AN EXAMPLE SHELL="/bin/bash" ... ...
0 + 1 = 1 != 2 <> 3 != 4 ...
Until the camel can pass though the eye of the needle.
- 05-02-2010 #5Linux Newbie
- Join Date
- Jan 2010
- Location
- usa
- Posts
- 124
you mean like this please look at my attached pic
- 05-02-2010 #6Linux User
- Join Date
- Nov 2009
- Location
- France
- Posts
- 292
Not readable !
0 + 1 = 1 != 2 <> 3 != 4 ...
Until the camel can pass though the eye of the needle.
- 05-02-2010 #7Linux Newbie
- Join Date
- Jan 2010
- Location
- usa
- Posts
- 124
i hope this pic is better
- 05-02-2010 #8Linux User
- Join Date
- Nov 2009
- Location
- France
- Posts
- 292
Why don't you just copy/paste the data ?
You have a typo at /bin/bach -> /bin/bash
You may complete your PATH variable to be exactly the environment PATH one.
You don't need sudo if it's root cron job.0 + 1 = 1 != 2 <> 3 != 4 ...
Until the camel can pass though the eye of the needle.
- 05-02-2010 #9Linux Newbie
- Join Date
- Jan 2010
- Location
- usa
- Posts
- 124
You may complete your PATH variable to be exactly the environment PATH one.
i do not know what you are talking about
acer@kacer:~$ sudo crontab -e
PATH ="/bin:/usr/bin:/usr/local/bin"
SHELL="bin/bash"
0 16 * * * apt-get update && apt-get dist-upgrade -y # JOB_ID_1
0 12 * * * apt-get update && apt-get dist-upgrade
- 05-02-2010 #10Linux User
- Join Date
- Nov 2009
- Location
- France
- Posts
- 292
In a shell, get the environment PATH variable content :
and set the cron PATH variable accordingly.Code:echo $PATH
You have one more typo : bin/bash -> /bin/bash
There'll be no valid reason left for this cron job to fail.0 + 1 = 1 != 2 <> 3 != 4 ...
Until the camel can pass though the eye of the needle.


Reply With Quote