Periodic execution of a program
mike at bria.UUCP
mike at bria.UUCP
Sat Jan 26 14:22:52 AEST 1991
In article <5829 at rex.cs.tulane.edu> rex.cs.tulane.edu!rawdon (Michael Rawdon) writes:
>I'm trying to get a program to run on a daily basis, at the same time each
>day (more or less). Being just a normal user, I don't have access to
>crontab. I was investigating a function called 'at', but it doesn't seem
>to be quite what I want. [...]
Well, then tell your admin to get off his butt and either put you in
/usr/lib/cron.allow, or touch /usr/lib/cron.deny. This will convince cron
that you are allowed to have cron jobs executed on your behalf (personally,
I find it a tad apalling that you don't have the permission to create a
crontab).
Once that's done, you can submit a list of commands to be executed using
the crontab(1) command.
Now, if your admin is a jerk, and doesn't think that users have any business
with cron, you could write a little script, such as:
---[ cut here ]-------------------------------------------------------------
trap '' 1 2 3 15
cmd=$1
shift
args="$*"
set `who am i`
user=$1
while :
do
minute=`date +%M`
sleep `expr \( 60 - $minute \) \* 60`
while [ `date +%H` != 1 ]
do
sleep 3600
done
$cmd $args </dev/null 2>&1 | mail $user
done
---------------------------------------------------------------------------
So, if you wanted to do a tar backup of /u every morning, you would
simply enter the name of script (let's call it not.cron) followed by
the command in question, such as:
$ not.cron tar cvf /u &
This would run until the system was rebooted, or someone killed it.
--
Michael Stefanik, Systems Engineer (JOAT), Briareus Corporation
UUCP: ...!uunet!bria!mike
--
technoignorami (tek'no-ig'no-ram`i) a group of individuals that are constantly
found to be saying things like "Well, it works on my DOS machine ..."
More information about the Comp.unix.questions
mailing list