mirror of
https://github.com/yavook/kiwi-cron.git
synced 2024-11-21 15:03:01 +00:00
modularity
This commit is contained in:
parent
718ddec618
commit
0cd472a08f
3 changed files with 61 additions and 25 deletions
|
@ -1,9 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
# replace crontab
|
||||
/usr/local/libexec/kiwi-cron/schedule_dirs \
|
||||
| /usr/local/libexec/kiwi-cron/print_crontab \
|
||||
| crontab -
|
||||
|
||||
# run crond
|
||||
exec crond -fd 8
|
||||
exec /usr/local/libexec/kiwi-cron/run_cron \
|
||||
"${@}" \
|
||||
/usr/local/libexec/kiwi-cron/schedule_dirs
|
||||
|
|
40
libexec/kiwi-cron/run_cron
Normal file
40
libexec/kiwi-cron/run_cron
Normal file
|
@ -0,0 +1,40 @@
|
|||
#!/bin/sh
|
||||
|
||||
# check for CLI options
|
||||
while getopts ':n' rc_optarg; do
|
||||
case "${rc_optarg}" in
|
||||
n)
|
||||
rc_dry_run="yes"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Invalid option: -${OPTARG}."
|
||||
exit 2
|
||||
esac
|
||||
done
|
||||
|
||||
shift "$(( OPTIND - 1 ))"
|
||||
|
||||
# CLI arguments
|
||||
rc_executable="${1}"
|
||||
|
||||
|
||||
if [ -n "${rc_dry_run}" ]; then
|
||||
# verbose, dry run
|
||||
set -x
|
||||
|
||||
"${rc_executable}" \
|
||||
| /usr/local/libexec/kiwi-cron/print_crontab
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# replace crontab
|
||||
"${rc_executable}" \
|
||||
| /usr/local/libexec/kiwi-cron/print_crontab \
|
||||
| crontab -
|
||||
|
||||
# hand over to crond
|
||||
exec crond -fd 8
|
||||
|
||||
exit 0
|
Loading…
Reference in a new issue