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

4
  • 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, 2015 at 22:41
  • 3
    possible duplicate of How to run scripts on start up?
    – muru
    Sep 15, 2015 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 raspberrypi.org/documentation/linux/usage/rc-local.md do you want to post it as an answer so I can accept it? Sep 16, 2015 at 0: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? Sep 16, 2015 at 16:35

1 Answer 1

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

1
  • Hi, thanks but i can't you the startup program, I am exclusivley using the terminal for this project Sep 15, 2015 at 23:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .