toolkit/func/core/pkg_cron/10-dot-cron.sh
2021-07-04 23:50:25 -07:00

39 lines
711 B
Bash
Executable File

#!/bin/bash
r_log "cron" "Testing hourly cron jobs"
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 $?
/bin/rm /etc/cron.{weekly,daily,hourly}/rocky.sh