#!/bin/sh set -e #################################################################################################### ### Crontab settings #################################################################################################### cat<> /var/log/update_camera_$(date +\%Y\%m\%d\%H\%M\%S).log 2>&1 EOF #################################################################################################### ### Run prescripts #################################################################################################### php /opt/init_db.php #TODO add db_migrations echo "Prescripts done" #################################################################################################### ### Run script once immediately #################################################################################################### echo "Running update once initially..." sh /opt/update_camera.sh >> /var/log/update_camera_$(date +\%Y\%m\%d\%H\%M\%S).log 2>&1 echo "Initial update done" #################################################################################################### ### Run cron to schedule periodic task #################################################################################################### # see: https://github.com/dubiousjim/dcron/issues/13 # ignore using `exec` for `dcron` to get another pid instead of `1` # exec "$@" "$@"