how to autostart on Biolinux/Ubuntu

I gem installed sequenceserver on Biolinux and it works great - I like it a lot and I think it is a great piece of software.

I have one question, however. I would like sequenceserver to start automatically upon reboot, preferably before the user login. I tried several methods and googled a lot, but no method so far worked. The software starts normally from the CLI.

Am I missing something obvious? Is there a recommended way for autostarting sequenceserver?

Hi Cene,

I am glad you like SequenceServer and I am sorry about the delay in reverting to your email.

Create a file /etc/sequenceserver.conf with the following contents:

description “Upstart script for SequenceServer"

author “Cene Gostinčar”

start on filesystem
stop on shutdown

script
exec sudo -H -u </path/to/sequenceserver> >> /var/log/sequenceserver.log 2>&1
end script

Replace with the username you run SequenceServer as from the CLI (most likely yours).

Replace </path/to/sequenceserver> with the output of the following command:

echo “$(ruby -e ‘puts Gem.path[0]’)/gems/sequenceserver-1.0.8”

Stop the SequenceServer instance you are already running and test the above Upstart config is able to start SequenceServer by running the following command:

sudo initctl start sequenceserver

The output of above command will indicate if the process started successfully or not. If it was not successful, hopefully something will have been written to /var/log/sequenceserver.log so we can troubleshoot.

Priyam

Correction:

[…]

Replace </path/to/sequenceserver> with the output of the following command:

echo "$(ruby -e 'puts Gem.path[0]')/gems/sequenceserver-1.0.8”

echo "$(ruby -e 'puts Gem.path[0]')/gems/sequenceserver-1.0.8/bin/sequenceserver”

Priyam

Dear Priyam,

thank you very much for your instructions! I followed them and successfuly checked the syntax with

sudo init-checkconf /etc/sequenceserver.conf

However, when trying to
`
sudo initctl start sequenceserver.conf

`
I get the message “initctl: Unknown job: sequenceserver”.

If I move the .conf file to /etc/init/ I get the message:
sequenceserver stop/waiting

The log is empty. I am unsure how to proceed from here …

Maybe running

sudo initctl reload-configuration

will help with that?

Also, not sure if you should add .conf at the end when running initctl start.

Priyam

Unfortunately no luck there … I tried to reload the configuration before with no success.

Adding “.conf” when starting just leads me back to “initctl: Unknown job: sequenceserver.conf”

I am not sure - I recently setup SequenceServer on an Ubuntu machine using upstart.

I would Google a bit and see. This thread on StackOverflow has a couple of tricks - http://askubuntu.com/questions/247077/upstart-is-not-seeing-my-new-script

And check syslog, etc.

Priyam

I played around with the settings a bit and what worked was putting the sequenceserver.conf into /etc/init/

The content of the file:

`
description “Upstart script for SequenceServer”
author “Author”

start on filesystem
stop on shutdown
console none

script
exec sudo -H -u </path/to/sequenceserver> background
end script

respawn limit 10 10
`

Not sure how correct this is, but for now it appears to work.
Thank you for your help!

Oops. It was a mistake on my part that I asked to put the file in /etc instead of /etc/init in the original email :(. I am so sorry.

Priyam

I added this to the docs for future reference - http://www.sequenceserver.com/doc/#upstart.

Priyam

That is great, thank you!

And of course with Ubuntu 16.x we now are no longer using Upstart, which has been replaced with SystemD. Since I’ve already upgraded to 16 I’m going to take a stab at writing a SystemD startup script - unless someone else already has one? :slight_smile:

I’ve had zero success getting sequenceserver to start on bootup with SystemD. I still have to launch it manually! Any suggestions?

I’m still on upstart.

I’ve done a little digging and I’m wondering if perhaps there is an issue with the 1.0.8 Ruby code that’s causing SystemD to fail. Here’s what I get in the logs:

sequenceserver.service - Start Up SequenceServer
Loaded: loaded (/etc/systemd/system/sequenceserver.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2016-08-25 13:09:28 EDT; 3 days ago
Process: 3108 ExecStart=/SequenceServerStartup.sh (code=exited, status=1/FAILURE)
Main PID: 3108 (code=exited, status=1/FAILURE)

Aug 25 13:09:28 CULTURE3 SequenceServerStartup.sh[3108]: from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require'** **Aug 25 13:09:28 CULTURE3 SequenceServerStartup.sh[3108]: from /var/lib/gems/2.3.0/gems/sequenceserver-1.0.8/bin/sequenceserver:152:in block (2 levels) in <top (required)>'
Aug 25 13:09:28 CULTURE3 SequenceServerStartup.sh[3108]: from /var/lib/gems/2.3.0/gems/slop-3.6.0/lib/slop.rb:260:in parse!'** **Aug 25 13:09:28 CULTURE3 SequenceServerStartup.sh[3108]: from /var/lib/gems/2.3.0/gems/slop-3.6.0/lib/slop.rb:65:in parse!'
Aug 25 13:09:28 CULTURE3 SequenceServerStartup.sh[3108]: from /var/lib/gems/2.3.0/gems/sequenceserver-1.0.8/bin/sequenceserver:24:in <top (required)>'** **Aug 25 13:09:28 CULTURE3 SequenceServerStartup.sh[3108]: from /usr/local/bin/sequenceserver:23:in load’
Aug 25 13:09:28 CULTURE3 SequenceServerStartup.sh[3108]: from /usr/local/bin/sequenceserver:23:in `'
Aug 25 13:09:28 CULTURE3 systemd[1]: sequenceserver.service: Main process exited, code=exited, status=1/FAILURE
Aug 25 13:09:28 CULTURE3 systemd[1]: sequenceserver.service: Unit entered failed state.
Aug 25 13:09:28 CULTURE3 systemd[1]: sequenceserver.service: Failed with result ‘exit-code’.

Do any of those error messages make sense in a Ruby context?

Could be systemd’s environment is unfavourable to RubyGems. I would try setting GEM_PATH env variable in sequenceserver.service file to the output of

ruby -e “puts Gem.path.join(’:’)”

Priyam