3. Alright. So what does it do.
Notareplacementforupstart/systemd/init
Complimentsservicemanager.How?
Service manager start your process on boot, but do not monitor crash
Does not depend of pid files
Allows non root users to start/stop/restart user level services
Ordering of service start up
Daemonizes your script and logs its <stdout> and <stderr>
Provides hooks you could exploit in your code
Readityourselves
5. Lets Process!
Yourprocessneednotbeadaemon
Couldbeassimleasprintingafewlines
Yes just print. Supervisord will log it for you.
importos
importtime
sin,sout,serr=os.popen3('ps足ef')
while1:
printsout.read()
printserr.read()
time.sleep(10)
Tellsupervisordtomanageyourprocess
[program:process_check]
command=python /home/akandavelu/spyder/supervisord_learning/process_check.py
6. Start ! Stop ! Restart !
Relax!supervisorctlwilldoitforyou.
supervisorctl -u user -p 123 status process_check
supervisorctl -u user -p 123 restart process_check
supervisorctl -u user -p 123 stop process_check
supervisorctl -u user -p 123 tail process_check
7. That is not all
Processwillbestartedintheorderinwhichtheyare
specified
Morecontrolonprocessisavailablethroughevents
Processcanbestarted/stoppedingroups
Completelistofprocessoptions
8. Lets do it on Web
EnableXMLRPCandHTTPinsupervisorconfigfile
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
chmod=0700 ; socket file mode (default 0700)
chown=nobody:nogroup ; socket file uid:gid owner
username=user ; (default is no username (open server))
password=123 ; (default is no password (open server))
[inet_http_server] ; inet (TCP) server disabled by default
port=127.0.0.1:9001 ; (ip_address:port specifier, *:port for all iface)
username=user ; (default is no username (open server))
password=123 ; (default is no password (open server))
9. Do it from another program
TheXMLRPCapiallowsforinteractiontosupervisord
programatically
import xmlrpclib
server = xmlrpclib.Server('http://localhost:9001/RPC2')
server.system.listMethods()
server.supervisor.getAllProcessInfo()