Sign up ×

I have written several upstart scripts to start transmission-daemon for several users. The script is this:

start on (local-filesystems and net-device-up IFACE=eth0 and runlevel [235])
stop on runlevel [016]

kill timeout 50


env USER=user
env PIDFILE=/var/run/

    DAEMON=$(which transmission-daemon) || exit 0

    exec start-stop-daemon --start --quiet --chuid $USER --pidfile $PIDFILE --make-pidfile --exec $DAEMON -- -f --config-dir $CONFIGDIR --logfile $CONFIGDIR/daemon.log
end script

post-stop exec rm -f $PIDFILE

I would convert this:

env USER=user
env PIDFILE=/var/run/

To this:

env USER=user
env PIDFILE=/var/run/transmission-$

But upstart doesn't allow. I can do it if I move those lines to the script section:

end script

But in this case, the PIDFILE, in post-stop section, is empty.
Is there any way to do this?

share|improve this question

1 Answer 1

This is a fairly old bug in upstart:

To get the variable in post-stop and script... you'll just have to set it both times to work around the bug.

share|improve this answer

Your Answer


