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

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -