Linux Gurus: Any ideas why i would have a bad day/month crontab file ?

aberant

Golden Member
Dec 6, 1999
1,096
0
0
Trying to edit crontab and it wont let me :( gives above error - btw sorry if i'm ambiguous here i've not a clue when it comes to linux. tia ! :)
 

Poof

Diamond Member
Jul 27, 2000
4,305
0
0
I know that there are invisible "columns" where you can put an explicit number or a "*" in the job's line... eg., when I run ppstats on my alpha, I have a line in there that goes:

20 * * * * root cd /usr/ppstats-rc5-7.1; perl ppstats-rc5-7.1.pl

I think the "columns" are minutes after the hour, the hour, the day, the week, & the month, to equal 5 "columns". So this job runs at 20 minutes after every (the "*") hour, every day (the 2nd "*"), every week (the 3rd "*") , etc. etc.

Perhaps you have a wrong digit in one of the columns, eg., a "26" in the column for hours (which is impossible) or a "5" for week number, or a "15" in the month column....??? :confused:
 

Eponymous

Golden Member
Jun 7, 2001
1,186
0
0
The one that catches me a lot is that you can have NO blank lines at the end of the file.

And the order is:

minute (0-59),
hour (0-23),
day of the month (1-31),
month of the year (1-12),
day of the week (0-6 with 0=Sunday).

commas are used to for multiple entires. So 0,10,20,30,40,50 would be every ten minuts if in the first column.
* (stars, or splats) are used to say any are good for me.

EG: 0,10,20,30,40,50 * * * * some comand here

would run every 10 minutes all the time.

And remember you cannot have any blanks lines even if it does make it look pretty!

Note there is also no zero-th month or zero-th day.

Edit: Oh yeah... Also edit the file using the crontab command and not going to the file directly.
Otherwise it won't see the changes you made to the crontab file until you reboot.
And if you don't like the editor it uses when crontab comes up you can change it by setting the EDITOR
environment variable to whatever editor you like.


 

aberant

Golden Member
Dec 6, 1999
1,096
0
0
lol, well after 3 days of buggering about, it seems that a) Vi is a bitch, and b) there should be a space between the stars, and only a comma when u enter a numerical :eek: thanx for the help guys - i'm starting to like linux even tho it's damn hard !
 

aberant

Golden Member
Dec 6, 1999
1,096
0
0
ok. so now i got the crontab edit to work, but now the prog i'm trying to load wont load - ie nothing happens, so i tried to /root/setiathome and it says 'permission denied'. even tho i'm logged in as root ! what's that all about ?
 

Eponymous

Golden Member
Jun 7, 2001
1,186
0
0
Hmmm,

Assuming setiathome is your executable and not a directory, or a link or .....
What do you get when you type:

ls -l

in the /root directory. It should look something like:

-rwxr-xr-x root other 1234 Jun 6 18:05 setiathome

Basically you need the -rwx in the front (well at least -r-x) for it to run. Also you will need write permissions on the directory too.

If you get drwx then it is a directory and your stuff really is inside of that.


I know this is crime but you could also try reading:
rolleye.gif


man ls
man chmod

assuming the man pages are installed.
That should explain in some form of Geek or Ancient Geek the permissions on files and stuff.

If any of that doesn't make sense just get back to us with the results of the ls -l /root/setiathome

and we let you in on the evils of chmod. :Q
 

ColinP

Golden Member
Oct 10, 1999
1,359
0
0
If you tell him about chmod you'll have to tell him about chown !!!!!

Then you'll have let the cat out of the bag....

:eek:

Col
 

blade47

Golden Member
Dec 12, 1999
1,353
0
0
LOL I had quite a time as well but didn't encounter any of the problems you have had so far. I do like linux more now after fighting with it for a few days and vi does get easier with time. :D
 

aberant

Golden Member
Dec 6, 1999
1,096
0
0
lol, well i got vi clocked, figured out why setiathome wouldnt load - was permission n stuff - did chmod +x and now it works. BUT, the crontab doesnt load setiathome still. is there a way i can find an error output to find out why ? thanx :)
 

ColinP

Golden Member
Oct 10, 1999
1,359
0
0
Cut & paste your crontab in here...

It will probably be a syntax error, or it could still be a permissions error maybe....

A simple way to do it would be below...
Tries to start at 10 past every hour, changes directory to /setiathome, runs the executable seti, points it to a proxy (eg setiQ), at a low priority, sends all messages to the bin, runs in the background...

10 * * * * cd /setiathome;./seti -proxy x.x.x.x:nnnn -nice 19 > /dev/null 2>&1 &

check that you haven't run seti at any time as a higher priority that your crontab (eg if your crontab is for user aberant, but at some point you have run seti as root, this may cause a problem....

to make sure you could do the following..
Assuming everything is in the directory /setiathome/
Assuming you want to run it as user aberant

cd /
chmod -R 777 /setiathome/
chown -R aberant /setiathome/
cd /setiathome/
rm lo*

see if that helps,

Col
 

aberant

Golden Member
Dec 6, 1999
1,096
0
0
0 * * * * cd /usr/local/seti/setiathome;./setiathome -proxy 192.168.1.101:5517 -nice 19 > /dev/null 2> /dev/null

any missing spaces / spaces that should b there ? cheers guys
 

Eponymous

Golden Member
Jun 7, 2001
1,186
0
0
It looks like you forgot the & at the end, the command that puts it into the background.

If you want to see what it is doing you can change the /dev/null to something like /tmp/output
and then you can read what it is saying.

more /tmp/output

Of course you may need to wait an hour before anything shows up. ;)

Also remember it needs to be on one line. You will start to get some serious errors if you add a <return>
breaking it into two lines.

If you absolutely need to break it into two lines a \ at the end of the line will tell it to continue to the next.
 

blade47

Golden Member
Dec 12, 1999
1,353
0
0
I think the & was left out so seti would show up. Then after it was told what email addy to use the & was going to be added so that it would run in the back ground.

It can take quite some time for seti to launch when you run it like that. If I'm not mistaken doesn't that tell seti to launch at the top of each hour? So you'd have to wait until then for it to launch if that's so.
 

Eponymous

Golden Member
Jun 7, 2001
1,186
0
0
Leaving the & out to see what happens is "bad".

Since Seti, if run successfully, never returns you would just lock up your cron jobs and it would
never give you an answer.

Remember the crontab is running the job and not you. It is not like it is going to dump it to
the screen. It is going to email you the answer as an error message anything that got printed out.
Now it does run it as "you", but in the background somewhere, somewhere where you can't see it.

With the /dev/null stuff, nothing is going to get printed out. It is just going to lock up your cron daemon.

Leaving out the & is "bad". If the command was short and returned, then it might have worked.

If he hasn't added the email address then he has problems. He should run Seti by hand (from the command lline) once
first giving it the email address, so it requires no input from the keyboard and it should be fine. Break out after it gets going
and then let the crontab restart it.

You never get a chance to type input to a cron job. You could set up a file that provides input but
keyboard input is just not going to happen.