\begin{Dave Kempe}
> Wondering where I would start to write a script that checked to see if the
> PPP link was up and if it wasn't brought it up? I know that the modem lock
> files would be useful cos nothing else uses the modem, so the existance of
> /var/lock/LCK..ttyS0 is reasonable. Or is there a better way in /proc
> something.

 test -f /var/lock/LCK..ttyS0 || ifup ppp0

ie: the lock file exists, or we run the command to bring the ppp0 link
up (you might need a different command, i just made that part up)

best is to get pppd itself to bring the link back up. check pppd(8)
for the "persist", "idle" and "holdoff" options. then you just
start/stop pppd when you want the link up/down.

> The other question i have is how to understand the entries in crontab.
> I have read a few cron tutuorials, and still don't exactly understand how to
> make cron do something once an hour or once a day.
> I don't exactly understand what each column means in the 6 or so *'s that
> are at the start of the crontab entry. Anyone care to share the secret?

see crontab(5):

              field          allowed values
              -----          --------------
              minute         0-59
              hour           0-23
              day of month   1-31
              month          1-12 (or names, see below)
              day of week    0-7 (0 or 7 is Sun, or use names)

so something like:

 43 13 5 * *  run_this_command

means: run "run_this_command" at 1:43pm on the 5th day of the month,
whatever month or day of the week that is.

once a day (at 6am):  0 6 * * *

once a week (3am tuesday): 0 3 * * 2


vixie cron (the one all linux distros use) is a lot more flexible than
the traditional unix syntax, and allows nice names for months and
days, ranges, lists and step values:

run each hour between 9-5, weekdays:  0 9-17 * * mon-fri

run every 30 minutes, for two hours in the morning, and two hours in
the afternoon:  0,30 9-11,16-18 * * *

run every 2 hours, weekdays: 0 9-17/2 * * mon-fri

run every 2 hours: 0 */2 * * *


that should be more than enough examples to get you going


(for daily or weekly system tasks, most distros have a directory, in which
all scripts get run. eg: on debian /etc/cron.daily/, /etc/cron.weekly/,
etc. so you just have to put your script in there)

-- 
 - Gus


--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug

Reply via email to