0

I am new to Ubuntu 14.04. I am trying to write a script that is being executed when ubuntu boots.

so my script file gunicorn.sh looks like this

cd /path/to/folder/with/manage.py/
exec gunicorn --env DJANGO_SETTINGS_MODULE=app.my_settings app.wsgi

I made it excutable and now when I run it using this

./gunicorn.sh

it works. Now I placed it into

/etc/init.d

and did this

sudo update-rc.d -f gunicorn.sh defaults

and I got this message

update-rc.d: using dependency based boot sequencing insserv: warning: script 'gunicorn.sh' missing LSB tags and overrides which I found out is not important.

However, when I boot it doesn't work, it's not executing the script

  • Just add those commands to /ewtc/init.d/rc.local (create the file if you wish). The error message you are getting are because you did not write a proper init script. – Panther Sep 15 '15 at 22:41
  • 3
    possible duplicate of [How to run scripts on start up?](http://askubuntu.com/questions/814/how-to-run-scripts-on-start-up) – muru Sep 15 '15 at 22:49
  • Thanks, that worked, I added it to the top of the rc.local. I also found it as a solution in the pi doc https://www.raspberrypi.org/documentation/linux/usage/rc-local.md do you want to post it as an answer so I can accept it? – Paul Bernhard Wagner Sep 16 '15 at 00:07
  • Ok, I did put it in but I realized it's not going to last long. The gunicorn command gets exectued and then it stops at some point. How do I do it that it doesn't get stopped? – Paul Bernhard Wagner Sep 16 '15 at 16:35

1 Answers1

0

Your error is because you need to add LSB tags to the script. See here:

https://wiki.debian.org/LSBInitScripts

An easier way to do this do is just to add a new startup application. Search "Startup Applications" in the dashboard and point to your script. This way you can keep it anywhere you want.

example

Eric Schafur
  • 81
  • 1
  • 7