supervisord - Can i run multiple processes (each with different port) using systemd? -
i have following supervisord config(copied this answer):
[program:myprogram] process_name=myprogram%(process_num)s directory=/var/www/apps/myapp command=/var/www/apps/myapp/virtualenv/bin/python index.py --port=%(process_num)s startsecs=2 user=youruser stdout_logfile=/var/log/myapp/out-%(process_num)s.log stderr_logfile=/var/log/myapp/err-%(process_num)s.log numprocs=4 numprocs_start=14000
can same thing systemd?
a systemd unit can include specifiers may used write generic unit service instantiated several times.
example based on supervisord
config: /etc/systemd/system/mydaemon@.service
:
[unit] description=my awesome daemon on port %i after=network.target [service] user=youruser workingdirectory=/var/www/apps/myapp type=simple execstart=/var/www/apps/myapp/virtualenv/bin/python index.py --port=%i [install] wantedby=multi-user.target
you may enable / start many instances of service using example:
# systemctl start mydaemon@4444.service
article more examples on fedora magazine.org: systemd: template unit files.
Comments
Post a Comment