Skip to content

Instantly share code, notes, and snippets.

@1ycx
Last active May 30, 2022 08:06
Show Gist options
  • Save 1ycx/1bcc53ed064fd19c71ca9e797e392abf to your computer and use it in GitHub Desktop.
Save 1ycx/1bcc53ed064fd19c71ca9e797e392abf to your computer and use it in GitHub Desktop.
Cronjob for Alarm
# flush your motor circuit on reboot to avoid unexpected spray
@reboot /usr/bin/python3 /home/pi/alarm.py "flush"
# Refer to https://crontab.guru
# change 0 6 * * * to an expression of your choice
0 6 * * * /usr/bin/python3 /home/pi/alarm.py
# Experimental - syslog gets flushed on reboot, have to try another way
# cron logs to `stdout` syslog
# we also want to log `stderr` output to syslog with a CRON_ALARM tag
# 0 6 * * * /usr/bin/python3 /home/pi/alarm.py 2>&1 | /usr/bin/logger -t CRON_ALARM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment