# buildtool - Upstart job file for the VIX buildtool description "JATS Build Daemon" author "dpurdie" # When to start the service start on runlevel [2345] # When to stop the service stop on runlevel [016] # Automatically restart process if crashed respawn # Essentially lets upstart know the process will detach itself to the background #expect fork # Specify the user setuid buildadm setgid ccperdev env USER=buildadm env HOME=/home/buildadm # Start the process # Uses sh, not bash or anything fancy # Run with '-e' - exit immediately if any untested command fails script # Rotate startup log files LOGFILE=/tmp/buildtool if [ -f $LOGFILE ] ; then for ii in 9 8 7 6 5 4 3 2 ; do last=$( expr $ii - 1 ) [ -f $LOGFILE.$ii ] && rm $LOGFILE.$ii [ -f $LOGFILE.$last ] && mv $LOGFILE.$last $LOGFILE.$ii done mv $LOGFILE $LOGFILE.1 fi exec 2>$LOGFILE 1>&2 echo $(date) ' -- Starting buildtool' . /etc/profile unset GBE_PLATFORM #jats vars -v jats -NoExportVars eprog /work/buildtool/abtlaunch || true echo $(date) ' -- Sleep 30 seconds before restarting' sleep 30 end script