toolkit/func/core/pkg_cron/10-dot-cron.sh

39 lines
723 B
Bash
Raw Normal View History

2021-07-05 06:50:25 +00:00
#!/bin/bash
r_log "cron" "Testing hourly cron jobs"
2023-11-21 08:23:44 +00:00
trap '/bin/rm /etc/cron.{weekly,daily,hourly}/rocky.sh' EXIT
2021-07-05 06:50:25 +00:00
cat > /etc/cron.hourly/rocky.sh <<EOF
#!/bin/bash
echo "obsidian"
EOF
chmod +x /etc/cron.hourly/rocky.sh
run-parts /etc/cron.hourly | grep -q "obsidian"
r_checkExitStatus $?
r_log "cron" "Testing daily cron jobs"
cat > /etc/cron.daily/rocky.sh <<EOF
#!/bin/bash
echo "obsidian"
EOF
chmod +x /etc/cron.daily/rocky.sh
run-parts /etc/cron.daily | grep -q "obsidian"
r_checkExitStatus $?
r_log "cron" "Testing weekly cron jobs"
cat > /etc/cron.weekly/rocky.sh <<EOF
#!/bin/bash
echo "obsidian"
EOF
chmod +x /etc/cron.weekly/rocky.sh
run-parts /etc/cron.weekly | grep -q "obsidian"
r_checkExitStatus $?