crontab file

jamin123

Member
Apr 27, 2005
36
0
0
how do I create a crontab to run at root at 7:30 daily.

30 7 1 * * root run-part /etc/cron.daily

how to create and where to save?

crontab -e then type the entry above didn't work
crontab -u root
I saw the command in the man page but I still don't get it.
 

Sunner

Elite Member
Oct 9, 1999
11,641
0
76
Firstly, specifying which OS you're usng is helpful, don't know but it wouldn't surprise me if some nix'es have oddball crontab formats.

Anyway, the format used in every nix I've used is:
minute hour day-of-month month day-of-week command
For example, running "cp /foo/bar /foobar" at 08:00 every Monday would be:
"0 8 * * 1 cp /foo/bar /foobar"

To edit the crontab, the easiest way is to just login as the user whose crontab you wanna edit and run "crontab -e", under Solaris you'll need to have the EDITOR variable set.
Can't say I remember if it defaults to ed or not, but that's pretty much the same as an error, so who cares ;)

I'm guessing it didn't work because of the "root" part of your crontab, you don't specify the username in the crontab.
 

jamin123

Member
Apr 27, 2005
36
0
0
I am using Linux Enterprize version 4. This for a lab practice. I have a user name john and I want run a crontab every day morning at 7:05 in /bin/bash to say "howdy".

I login as user and used and created the the below file with crontab -e
05 8 * * * /home/john/howdy
echo howdy

When I tried to say it says erro in "5" time. I am following the book but can't get it to work.
 

Sunner

Elite Member
Oct 9, 1999
11,641
0
76
What's the "/home/john/howdy" part for?
If all you wanna do is echo "howdy" the crontab would be fine if you removed the "home..." part and put the echo command on the first line right of the time definition.
 

doornail

Senior member
Oct 10, 1999
333
0
0
Hmmm, wont stdout go into hyperspace if you run that from cron? You may need to use the 'say' command or something.