29 lines
502 B
Plaintext
Executable File
29 lines
502 B
Plaintext
Executable File
#!/bin/sh
|
|
# functions used to add or remove a dynamic task in the crontab
|
|
|
|
CRON_LIB=1
|
|
|
|
crontab_add() {
|
|
# $1 $2 $3 $4 $5 = timespec
|
|
# $6 = command
|
|
# $7 = name
|
|
|
|
local dir='/var/bewan/cron.d'
|
|
local spool='/var/spool/cron/crontabs'
|
|
|
|
mkdir -p $dir
|
|
mkdir -p $spool
|
|
|
|
echo "$1 $2 $3 $4 $5 $6" >$dir/$7
|
|
/etc/bewan/init.d/cron restart
|
|
}
|
|
|
|
crontab_remove() {
|
|
local name=$1
|
|
local dir='/var/bewan/cron.d'
|
|
if [ -f $dir/$name ]; then
|
|
rm $dir/$name
|
|
/etc/bewan/init.d/cron restart
|
|
fi
|
|
}
|