Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (22 sloc) 827 Bytes
description "Mirrors Zone Minder content to cloud box.com"
author "Sergi Adamchuk"
env NODE_BIN=/usr/bin/node
env APP_DIR=/home/sergi/zmwatcher/samples/zmmirror
env SCRIPT_FILE="mirror.js" # Entry point for the nodejs app
env LOG_FILE=/home/sergi/zmmirror.log
env RUN_AS="root" # Upstart can only be run nicely as root, need to drop privileges
start on runlevel [2345]
stop on runlevel [016]
# Respawn in case of a crash, with default parameters
respawn
script
rm -f $LOG_FILE
# Make sure logfile exists and can be written by the user we drop privileges to
touch $LOG_FILE
chown $RUN_AS:$RUN_AS $LOG_FILE
chdir $APP_DIR
su -s /bin/sh -c 'exec "$0" "$@"' $RUN_AS -- $NODE_BIN $SCRIPT_FILE >> $LOG_FILE 2>&1
end script
post-start script
echo "===== ZMMirror restarted =====" >> $LOG_FILE
end script