description "lxc instance"
author "Christian Kampka <chris@emerge-life.de>"

stop on stopping lxc

# wait for 120 seconds for container to shutdown before killing it
kill timeout 120

# send SIGPWR to container to trigger a shutdown (see lxc-shutdown(1))
kill signal SIGPWR


instance $NAME
usage "NAME=name of LXC instance"

pre-start script
	lxc-wait -s RUNNING -n $NAME -t 0 && { stop; exit 0; } || true
end script

exec lxc-start -F -n $NAME
