Mailinglist Archive: opensuse (4600 mails)

< Previous Next >
RE: [SLE] cron jobs
  • From: "Martin Mielke" <martin.mielke@xxxxxxxxxxxxx>
  • Date: Wed, 21 Jan 2004 17:33:10 +0100
  • Message-id: <IFEOKCMCMDBBKPDIKHKEEEMNCDAA.martin.mielke@xxxxxxxxxxxxx>
Hi,

>
> Donald Henson wrote:
> > Does anyone know if there's a way to set up a cron job using YaST?
>

crontabs with YaST? interesting... ;)

> I don't know about YaST, but it's easy to create a file in /etc/cron.d/
> with the jobs you need to run.
>
> Syntax is standard crontab (same as in /etc/crontab).

A secure way to create a crontab for a user is quite simple:

1. login as the desired user, for this example I assume 'martin'
2. vi martin_crontab
3. (see man crontab for the syntax). As example:

00 5 * * 1-6 /home/martin/scripts/backup_full

4. crontab martin_crontab

In point 2 you can use an editor of your choice (or create a file with 'cat
> file' )

In point 3 it's said that every day (1-6, or *) at 05:00 AM execute
/home/martin/scripts/backup_full (just an example, it doesn't exists :P )

In point 4 you actually install your crontab file under
/var/spool/cron/tabs.

If you read 'man crontab' you'll notice that you can edit your crontab file
using 'crontab -e', which is easier/faster than my 2,3,4-steps, so why do I
mention it? Because 'crontab -r' actually _removes_ your crontab file and
there's no chance to recover it, unless you have a backup somewhere. It's
not a big hasle if your crontab is as short as my example, but there are
*bigger* crontabs around and retyping it all from scratch might be annoying.
Because letters 'e' and 'r' are dangerously together on the keyboard, I
strongly recommend you "my method"; this way you always will have a backup
of your crontab file. And of course, if you need to change your crontab, do
it on the martin_crontab file (assuming that your user is 'martin').

HTH,

Martin



< Previous Next >
Follow Ups
References