Help with cron running a command at bootup

From Swerdna’s helpful page on mounting network shares, he talks about adding the following command to the root’s crontab to delay mounting the drives in case of slow networks.

@reboot sleep 10;mount -a

I tried adding this but can’t find a crontab for root in /var/spool/cron/tabs. Should I create one or is it located somewhere else?

Being root, do

crontab -e

and you will be using vi to edit root’s crontab.

BTW the same as for every user who wants to alter his crontab. See

man crontab

If you don’t like vi as the crontab editor, you can change it to Nautilus, Kwrite, whatever, by creating the file “profile.local” in directory /etc and giving it these contents:

export EDITOR=/usr/bin/gedit

or these, as you prefer

export EDITOR=/usr/bin/kwrite

might need a reboot, can’t remember

Isn’t it true that this will make this the prefered editor for everybody, being it in /etc? My wife would kill me! :frowning:

Yes it will lol!, so counteract it by putting this in her home territory: edit the file /home/hername/.bashrc and uncomment/fix this line:

export EDITOR=/usr/bin/vi (or whatever it is she likes)

And the piece de resistence:

export EDITOR /usr/bin/oowriter

that would cause a family rift I think.

Yes, I know how a user can change when she/he does not like the default, but as a system manager you must be very carefull changing the default (or even worse: without further notice).

Exception: when you are sure you are your only user and will forever be so.

In any case, I would prefer to do this in the .bashrc of root and not in a central place. And of course, as I try to propagate to the masses here, use

su -

and not

su

so root realy gets its environment and not that of a normal user.

I tried that but it said there was no crontab for root and that it would use an empty one. That threw me a little so I started doubting I was doing going about it correctly.

I would prefer to do this in the .bashrc of root and not in a central place.

I can’t find a .bashrc in root’s home directory. I assume I can just create one?

That is exactly what it says when you do this the first time. Go on! Type the letter i, type your crontab line, hit Esc, type** :wq **and there you are.