View Full Version : crontab not working
m3mary
10-05-2008, 08:27 AM
hello
yesterday i tried crontab it was working but now not working
i want to use it in automatic copying + do backups
Terra
10-05-2008, 12:56 PM
Couple things:
1) There is no cronjob in the server for your username, which leads to #2
2) Whatever crontab file you are trying to inject has a syntax error:
Change: Mailto:<your_email_address>
to: MAILTO=<your_email_address>
Replace "<your_email_address>" with your email address and without the gator signs...
m3mary
10-06-2008, 01:30 AM
for example im trying to test this
crontab -l
MAILTO=myemail@hotmail.com
24 * * * * zip -r zip.zip /big/dom/xuser/user/file.txt
this line (zip -r zip.zip /big/dom/xuser/user/file.txt) working fine without crontab.
but with crontab nothings happens
m3mary
10-06-2008, 01:40 AM
and also which time should i use :
Local Time
GMT/UTC Time
Kevin
10-06-2008, 01:51 AM
1) You should use the server's local time. Use the date command to see what it is.
2) Put a path on the zip.zip so that zip will know where to put it.
m3mary
10-06-2008, 02:02 AM
MAILTO=user@hotmail.com
24 * * * * zip -r /big/dom/xuser/user/zip.zip /big/dom/xuser/user/file.txt
not working also
Kevin
10-06-2008, 02:04 AM
Are you getting an error message in your email?
Also, *:24 hasn't happened since I posted.
m3mary
10-06-2008, 02:08 AM
nothing in email so i changed the email also but nothing
no errors no OK
Yesterday i got messages and it worked
Kevin
10-06-2008, 02:28 AM
OK, I think I have this figured out...
I am pretty sure that it would have just worked if you hadn't changed the job 2 minutes early. Here is the server log:
2008-10-06 02:22:00.124690500 bcron-sched: Reloading 'm3mary'
2008-10-06 02:24:00.126648500 bcron-sched: Warning: Ignoring unparseable line: '* 24 * * * zip -r /big/dom/xm3mary/m3mary/zip.zip /big/dom/xm3mary/m3mary/file.txt'
Note that at 02:22 you changed it from "24 *" to "* 24". "24 *" meant run it at 24 minutes past each hour. A time that didn't happen during the time it was set that way. "* 24" on the other hand would mean 24:00 which is not a valid time (midnight is 0:00).
Kevin
10-06-2008, 02:31 AM
And I see you have now changed it to "12 *" which means run at 12 minutes past each hour.
Also, you may as well use /usr/bin/zip instead of zip just to make sure every possible issue is covered.
m3mary
10-06-2008, 02:34 AM
Ok going to try it
m3mary
10-06-2008, 02:43 AM
crontab -l
MAILTO=user@hotmail.com
* 37 * * * /usr/bin/zip -r /big/dom/xuser/user/zip.zip /big/dom/xuser/user/file.txt
not working
the time passed and nothing
also in min 24 the time passed so i returen it to 24 *
m3mary
10-06-2008, 02:45 AM
i dont have crontab -u
maybe this is the reason
Kevin
10-06-2008, 02:48 AM
You are still doing it backwards.
The format is:
minutes hours date month day command parameters
* 37 * * * would mean to run the job at 37:00 and there is no such time.
Crontab will accept this but not tell you that it will never work.
37 * * * * would mean to run the job every hour at *:37 (0:37 1:37 2:37 etc).
Kevin
10-06-2008, 02:49 AM
Crontab -u is only for root. It allows the administrator to look at or manipulate the cron jobs of other users. You can only look at or manipulate your crontab so the -u parameter is useless.
m3mary
10-06-2008, 03:15 AM
crontab -l
MAILTO=user@hotmail.com
06 * * * * zip -r /big/dom/xuser/user/zip.zip /big/dom/xuser/user/file.txt
Worked OK but didnt inform me by email !
also i changed to :
crontab -l
MAILTO=user@hotmail.com
09 * * * * cp /big/dom/xuser/user/file.txt /big/dom/xuser/www/fullcon/
didnt worked .. trying to copy file from place to another
m3mary
10-06-2008, 03:33 AM
NOT WORKING AGAIN
i dont know how it worked prev.
this is the server time :
date
Mon Oct 6 03:33:33 EDT 2008
Terra
10-06-2008, 03:34 AM
1) There is nothing mailed to you if there is no output from the command, this is by design
2) use full paths for your binaries: /bin/cp and /usr/bin/zip
Also, please take some time and study:
http://service.futurequest.net/index.php?_a=knowledgebase&_j=questiondetails&_i=30
That should hopefully help...
m3mary
10-06-2008, 04:05 AM
there are no man crontab !!
i somehow entered an editing place, when trying to crontab -e
i didnt now how to go back so maybe i changed somthing in the script for crontab
check that also please
Arthur
10-06-2008, 04:44 AM
there are no man crontab !! The man page for crontab doesn't provide much useful information for beginners, the knowledge base article (http://service.futurequest.net/kb30) provides all the information you need.
i somehow entered an editing place, when trying to crontab -e
i didnt now how to go back so maybe i changed somthing in the script for crontab
The default editor is vi (vim to be more precise) (http://en.wikipedia.org/wiki/Vim_(text_editor)). Although it is a hugely powerful editor, it's not really for beginners, use the method described in the knowledge base (http://service.futurequest.net/kb30), or use another, simpler, editor like Joe or Pico (e.g. EDITOR=pico crontab -e).
-Arthur
m3mary
10-06-2008, 05:52 AM
should i do 2 files or one is enough for the last order
i mean should i do txt file for linking to cgi file in cgi-bin
MAILTO=user@domain.com
0 0 * * 1 /big/dom/xdomain/cgi-bin/scriptname.cgi
or it is enough for txt file to do it by included order in it
m3mary
10-07-2008, 12:00 PM
i think it is working now
first mistake don't check junk mail, so I'm going to mailto my FQquestmail
second mistake that i should leave it till one hour passing the time I'm using
for example using : minute 13 , should wait 1 hour on exact 13, that means next 5 minutes do not works.
m3mary
10-07-2008, 12:03 PM
it was a puzzle im working with 5 minutes and it is working after one hour and above
thanks all
vBulletin® v3.6.8, Copyright ©2000-2013, Jelsoft Enterprises Ltd.