Linux administrative tasks > Init script for python app
Author: Aleksandr Chirkov
Dec. 19, 2013, 2:11 p.m.

Lets make init script for our python app that it starts with system boot. Follow script below:



# Provides: myservice

# Required-Start: $remote_fs $syslog

# Required-Stop: $remote_fs $syslog

# Default-Start: 2 3 4 5

# Default-Stop: 0 1 6

# Short-Description: Put a short description of the service here

# Description: Put a long description of the service here


# Change the next 3 lines to suit where you install your script and what you want to call it




# This next line determines what user the script runs as.

# Root generally not recommended but necessary if you are using the Raspberry Pi GPIO from Python.


# The process ID of the script when it runs is stored here:


. /lib/lsb/init-functions

do_start () {

log_daemon_msg "Starting system $DAEMON_NAME daemon"

start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile --user $DAEMON_USER --startas $DAEMON

log_end_msg $?


do_stop () {

log_daemon_msg "Stopping system $DAEMON_NAME daemon"

start-stop-daemon --stop --pidfile $PIDFILE --retry 10

log_end_msg $?


case "$1" in









status_of_proc "$DAEMON_NAME" "$DAEMON" && exit 0 || exit $?



echo "Usage: /etc/init.d/$DEAMON_NAME {start|stop|restart|status}"

exit 1



exit 0


That's it. Add path to interpreter in python app (e.g.  #!/usr/bin/env python). Make executable both init script and our python app like bellow:

chmod +x /etc/init.d/myservice /usr/local/bin/

Add symbolic links for our init script and start our app:

update-rc.d /etc/init.d/myservice defaults && service myservice start


After that our app should start and work)

Propecia Low Sperm Count Stopped Levitra Originale 5 Mg [url=]viagra cialis[/url] Cheapeast Zentel Medication Discount Overseas Amoxicillin No Prescription Abc Pharmacy Canada Kamagra Jelly Usa Buy Cialis With No Prescription online pharmacy Comprare Cialis 20 Mg Venta De Cialis Online Zithromax Time To Work Is Zithromax Available In India Illegal Cialis Refrigeration Of Cephalexin - cialis Comprar Cialis Farmacia Barcelona Cialis Eli Lilly
Prezzo Viagra Pfizer Buy Periactins Online [url=]cheap cialis[/url] Cycotec Royal Drugstore Online Tadalafil 5mg Buy Online India Fluconazole Order In Usa Cialis Come Prenderlo cialis Isotretinoin Skin Health Priligy Y Epilepsia Achat Cialis Inde Effetti Collaterali Viagra Cialis Amoxicillin Stomach - cialis price Cialis Super Active Canada Buy
Cephalexin Atlanta Dental Prescription Free Amoxicillin [url=]cialis[/url] Buy Online Lasix Viagra Super Active Plus Review Achat De Valium Pas Cher Meilleure Facon De Durer Plus Longtemps cheap cialis Donde Comprar Cialis Farmacia Progesterone Website Pills C.O.D. No Prescription Buy Stendra Online Cialis Tablets For Sale Au Lasix With No Rx Fast Shipping - online pharmacy What Size Fluconazole For A Small Dog Amoxicillin Itchy Bumps Rash Picture Diclofenac Tablets Without Prescription
cialis prescribed for bph buy cialis online effects of cialis and viagra [url=]cialis online[/url] how long cialis stay in your system
cheap ed meds online ed medicines generic for erectile dysfunction ed medications best ed medication what are the best generic ed drugs online erectile dysfunction medications ed medications compared cheap ed medication ed medications online ed drugs online best erectile dysfunction medication in canada ed drugs meds for ed erectile dysfunction medications sold in canada erectile dysfunction drugs generic ed drugs cheap erectile dysfunction drugs-canada canadian erectile dysfunction drugs ED medication order erectile dysfunction medication generic drugs for erectile dysfunction erectile meds ed drug cost comparison buy erectile dysfunction drugs generic ed medication erectile dysfunction medication prices ed meds on line cheap ed drugs best erectile dysfunction drugs for sale online erectile dysfunction drugs online meds for erectile dysfunction generic ed meds erectile dysfunction drugs canada ed drug best ed drug best deal on ED meds cheap ed meds medication from canada ed erectile dysfunction generic name for ED drugs buy erectile dysfunction drugs online cheap erectile dysfunction medication generic erectile dysfunction medications erectile dysfunction drugs comparison impotence drugs online common drugs for ed generic impotence drugs ed meds cost effective ed drugs canadian erectile dysfunction drugs buy diprosalic no prescription uk viagra vs cialis vs levitra reviews buy amoxicillin canadian pharmacy lexapro no rx needed viagra pfizer sildenafil 100 mg canadian pharmacy online no script samples of viagra and cialis cialis 5 mg best price usa
cialis best price us [url=]buy cialis online[/url] cialisprescription viagra medecin [url=]buy viagra online[/url] generic viagra onlinenatural viagra substitute [url=]generic viagra online[/url] buy viagra online
enter site cheap cialis soft [url=]buy cialis[/url] cialis cheapbuy viagra usa online [url=]buy viagra online[/url] generic viagra onlineviagra instrucciones de us [url=]cheap viagra[/url] cheap viagra
cialis les effets [url=]buy cialis online[/url] generic cialis onlineviagra generico marcas [url=]canadian viagra[/url] generic viagra onlineovernight viagra soft tabs [url=]buy viagra online[/url] viagra online

Leave a comment:

Web development
Review Linux
Provisioning CVS
Windows AWS
Continuous Integration
NoSql Logging Web Servers FileSystems Scala
accurev ansible apach2 apache api application approaches architecture archivation argparse arguments artifactory automation awk aws backup bash batch-scripting beaver block build built-in caching call captcha cartridge case certificates cgi chain client cloud cloudformation cluster cmd coding collections command-line commands compression conditionals conversion convert cookbook copy counter cron crud css cut cygwin daemon datatype date dd debpackage decorator delattr deploy deque dict distributed-file-systems django DNS domain driver dropbox dump elasticcache elasticsearch encryption exit ext4 extra-tags failover file filename filters for form format freetds functions gerrit getattribute gid git globals glusterfs hardware hook iam indexing inheritance init install job-interview jquery ldap linux list locals logging logs logstash lookup magicmethods mail main-menu metadata metalogger mongodb moosefs mount mssql multiplatform multithreading mysql netcat nginx nosql open-ssh openldap openshift os packaging parse partition path pattern patterns permissions pid pil pip pipe playbook pool post post-commit processes production provisioning proxy putty python python-mysql recursively redirection redis register replication repr restore return review rotation scala script search selenium server setattr settings setup shipper signals singleton slots snapshot socket splunk ssh ssh-key ssl storage str string style subprocess sugar super switch syntactic syntaxhighlighter systeminfo tail tar templatetags time tls tune2fs tuple ubuntu unicode unique unix unixodbc usage usecases uuid uwsgi variable vars version vi virtualenv volume web web-server windows with_items __getattr__