1
0
Fork 0
mirror of https://github.com/yavook/kiwi-cron.git synced 2024-11-21 23:13:00 +00:00

modularity

This commit is contained in:
Jörn-Michael Miehe 2022-03-01 18:40:05 +01:00
parent 718ddec618
commit 0cd472a08f
3 changed files with 61 additions and 25 deletions

View file

@ -1,9 +1,5 @@
#!/bin/sh #!/bin/sh
# replace crontab exec /usr/local/libexec/kiwi-cron/run_cron \
/usr/local/libexec/kiwi-cron/schedule_dirs \ "${@}" \
| /usr/local/libexec/kiwi-cron/print_crontab \ /usr/local/libexec/kiwi-cron/schedule_dirs
| crontab -
# run crond
exec crond -fd 8

View 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