how to use crontab and cron.daily

nigel henry cave.dnb at tiscali.fr
Sat Jul 8 22:12:32 UTC 2006


On Saturday 08 July 2006 23:16, Mikkel L. Ellertson wrote:
> nigel henry wrote:
> > Ok. Just ran crontab -e, and again have got my newly created crontab, but
> > using vi, so presumably export EDITOR=nano was a one shot thing. I have
> > the vi cheat sheet, but I think you have to be using it all the time to
> > get really used to working with it, and probably the same goes for emacs.
> > I don't use text mode text editors much, and nano is for me the easier to
> > use. I'll edit ~/bash_profile and set nano as the editor to be used.
>
> When you use export <variable>=<value> it only has affect in the
> current secession. If you us it in a terminal, it only affects that
> terminal, and is gone when you close the terminal. If you do it at
> the CLI, it only affects that login secession.

Yes I only discovered that after having saved my newly made crontab. I edited 
the file in /var/spool/cron/$USER to change the time that crontab would run, 
so as to test if my shell script to play a sound would run. It did, but as 
Todd has said, I should not have been editing the file 
in /var/spool/cron/$USER. After reading Todd's comment I ran crontab -e , and 
sure enough my created crontab was there, but using vi, so as you've said, 
running export EDITOR=nano is only a one shot thing, and then reverts to the 
default, in this case vi. I've now changed the editor in ~/bash_profile to 
nano. Now crontab -e ( that is after logging out and back in) brings up nano.

I've learned a bit about crontab. I've learned a bit more about writing 
shellscripts, although very simple ones, and am very gratefull for the help 
that you've all given.

Thanks. Nigel.
>
> In this case, if you open a terminal, or log in to the command line,
> and run "export EDITOR=nano", then anything that uses the EDITOR
> variable to decide what editor to use will use nano. But if you use
> "su -" to change users, or log in on another VC, it will not be
> affective. The change is also lost when you log out, or close the
> terminal. Setting EDITOR affects more then just "crontab -e".
> Commands like vipw and vigr also use it. There are others, but those
> are the two that come to mind.
>
> Also, if you are using a terminal under X, you can also use X based
> editors like Kedit in place of Nano. If you really wanted to get
> fancy, you could write a script that uses the TERM variable to
> decide what editor to launch. (Ether EDITOR points to the script, or
> the script is run in .bash_profile to set EDITOR when the shell starts.
>
> Mikkel
> --
>
>   Do not meddle in the affairs of dragons,
> for thou art crunchy and taste good with Ketchup!




More information about the users mailing list