Upstarting (Synergy and Jira)

After some small headaches, I managed to setup my first two upstart scripts[1]. So, for your amusement, here they are:

Synergy

# Synergy server

description        "Synergy Server"
author            "Julio Biason "

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

umask 007

pre-start script
    [ -s /etc/synergy.conf ]
end script

exec /usr/bin/synergys

Jira

# Jira issue tracking

description        "Jira issue tracker"
author            "Julio Biason "

start on (local-filesystems)
stop on runlevel [016]

script
    su - jira
    # Yes, I just unpacked and run it. And I'll have to change this in case
    # I get a new version.
    cd /usr/local/jira/atlassian-jira-enterprise-4.1.2-standalone
    bin/startup.sh
end script

Note: I just noticed the Jira upstart doesn’t do a proper shutdown (calling bin/shutdown.sh). I’ll fix it later and post it again.


[1] “Small headaches” ’cause I’m used to the old way of writing startup scripts, which are way more explicit than upstart. But, once you got one running, this looks a bit simpler (although not as explicit as the old shell scripts.)