OS: Ubuntu 12.04
Task: run script at certain start/stop conditions. No long-running service/daemon is launched, only short-term actions.
Upstart script test.conf:
description "test script" start on local-filesystems or runlevel  stop on runlevel [!2345] task pre-start exec /full/path/to/script.sh start pre-stop exec /full/path/to/script.sh stop
- Running 'start test' never ends. If I Ctrl-C hanged upstart, furtehr 'status' calls show the service is running.'
- 'stop test' doesn't result in running 'pre-stop' stanza at all.
Is the original task solvable using upstart scripts?
Update. "the fact that your script.sh has both start and stop actions, which does suggest a long-running daemon"
No contradiction. There's startup action and cleanup action, without long-running process(es) in between.
When I add 'exec' stanza, i.e.
exec /full/path/to/script.sh idle
the result is this:
$ start test test stop/waiting $ status test test stop/waiting $ stop test stop: Unknown instance:
Correction: The script mentioned in stanzas is executed with 'start' and 'idle' parameters, but not with 'stop'.