PDA

View Full Version : crontab -e help


Evoir
04-14-2003, 02:05 PM
Howdie,

I am trying to edit my crontab file (Is that the right lingo?) and I have logged in using MacSSH and typed crontab -e

It gives me two lines of code, that I can use the delete button to edit. But, how do I save my changes? I tried using the esc button, but nothing happened. The Tutorial (http://www.aota.net/Script_Installation_Tips/cronhelp.php4) is very helpful, but I can't find info on how to save my changes. It is all bring back memories of Pine and IRC. whoa. %)

In the past, I have simply erased the cronjob and restarted, but I don't want to do that this time. I want to learn how do do it.

Anyway, any help would be greatly appreciated.

Thanks!
Evie

hobbes
04-14-2003, 03:35 PM
crontab uses the default editor, likely vi (aka vim). From the command line issue "man vi" or "info vi" to learn how to use it. Short answer to save (write) the file and quit the editor, after you hit ESC to stop editing, type in :wq[ENTER] (colon-w-q-ENTER). Yes, there are other ways of doing this, but for a newbie the long winded way is sometimes best:)

lepton
04-14-2003, 04:35 PM
While not an option in this case (crontab picks the editor), I'd like to stick in a plug for Midnight Commander (http://www.aota.net/Telnet/midnightcommander.php4).

If you're still new to using shell sessions (like I am), you'll love it! :clapper:

Terra
04-14-2003, 04:39 PM
If you want crontab to use mcedit, then this is simple...

While at the command line, type in:
$ export EDITOR=/usr/bin/mcedit

then run 'crontab -e', it will pull up as desired now...

--
Terra
--for extra credit, make this change permanent via .bashrc--
FutureQuest

Rich
04-14-2003, 06:13 PM
-OR-

(1) FTP Download

(2) Edit

(3) FTP Upload

:P

hobbes
04-14-2003, 06:26 PM
Or better yet ...

(1) SCP remote local

(2) Edit (using vi, of course) ;)

(3) SCP local remote

:P :P

Evoir
04-16-2003, 06:06 PM
Hey, finally got around to editing the cron file. Thanks, it worked. I also liked seeing all these other options.
Originally posted by Rich:
-OR-

(1) FTP Download

(2) Edit

(3) FTP Upload

:P

Rich, how does this work? What file do you download and then upload?

Rich
04-16-2003, 07:49 PM
Rich, how does this work? What file do you download and then upload?
Well, the short answer is: you download the file that contains your crontab commands. Where is this file? Where ever you put it...

Remember, that to start your crontab file you had to use:

crontab filename

where filename could be a fully qualified path to the crontab definition file. I usually just keep mine in the home directory with the name crontab.txt.

hobbes
04-17-2003, 09:36 AM
The default cron file on FQ's servers may be unreadable to users.