Run Python script at startup using upstart
114
Solution 1
Upstart scripts go in /etc/init not /etc/init.d, It was a long week that week. :(
Solution 2
- Do not use
respawn
initially. See: - Does python really fork? If not, remove
fork
. -
You can simplify the stanza to start your job to simply:
exec python /usr/local/scripts/script.py
What does
/var/log/upstart/yourjob.log
show?
Related videos on Youtube
Author by
Anthony DeFallo
Updated on September 18, 2022Comments
-
Anthony DeFallo over 1 year
I am working on a program where I will text a message to my Twilio number and have it send the message out to a group of people. I want the numbers to read from either a SQL database (so that people can sign up on a website via PHP) or through a Google Sheets spreadsheet. I really don't know where to start and was wondering if I could get some input from the pros.
Thank you!
Anthony
-
Zoredache over 11 yearsYour test script is not fork()ing so your expect line is probably wrong. Are you really sure you want to respawn?
-
never_odd_or_even over 11 yearsThis is just a test script I will want the script I plan to run in production to respawn. I'll take out the fork() and see how I go.
-
-
never_odd_or_even over 11 yearssudo /etc/init.d/script.conf gives the following output
line 3: description: command not found line 4: author: command not found start: Unknown job: on stop: Unknown job: on line 18: respawn: command not found Script started, file is typescript
-
never_odd_or_even over 11 yearsUpstart scripts go in /etc/init not /etc/init.d :(
-
Anthony DeFallo almost 7 yearsSo you would use the sheet to update the contact numbers and all, correct? And then in order to run both, will each one be in PHP? Sorry for all of the questions, I am very new to PHP coding.
-
Marcos Placona almost 7 yearsYou could have them both in the same program yeah.