Permalink
Switch branches/tags
Find file
Fetching contributors…
Cannot retrieve contributors at this time
45 lines (36 sloc) 1.32 KB
#!upstart
description 'start <%= @compiler %>'
## start job defined in this file after system services, and processes have
# already loaded (to prevent conflict).
#
# @vagrant-mounted, an event that executes after the shared folder is mounted
# @[2345], represents all configuration states with general linux, and
# networking access.
start on (vagrant-mounted and runlevel [2345])
## stop upstart job
stop on runlevel [!2345]
## restart upstart job continuously
respawn
## variables: 'setuid', 'setgid', are both used within the pre-stop stanza
#
# @setuid, required for permission to write to '/vagrant/' files
# @setgid, required for permission to write to '/vagrant/' files
# @DATE, preformatted string for datetime.
setuid vagrant
setgid vagrant
env DATE='date +%Y-%m-%d:%H:%M:%S'
## run upstart job as a background process
expect fork
## start upstart job
#
# @chdir, change the current working directory
chdir <%= @compiler_dir %>
exec ./<%= @compiler %>
## log start-up date
pre-start script
echo "$DATE <%= @compiler %> service watcher starting" >> /vagrant/log/webcompiler/<%= @compiler %>.log
end script
## log shut-down date, remove process id from log before '/vagrant' is unmounted
pre-stop script
echo "$DATE <%= @compiler %> watcher stopping" >> /vagrant/log/webcompiler/<%= @compiler %>.log
end script