0

I have a VPN service that I would like to manage through supervisord.

When the VPN service installs itself, it makes an entry in /etc/systemd/system/pgateway.service. Contents below:

[Unit]
Description=Cradlepoint NetCloud Client that provides access to secure overlay networks.
After=network.target

[Service]
Type=forking
PIDFile=/run/pGateway.pid
ExecStartPre=/bin/rm -f /run/pGateway.pid
ExecStart=/opt/pertino/pgateway/pGateway -f -p /run/pGateway.pid
TimeoutStopSec=30
Restart=on-abort
KillMode=process

[Install]
WantedBy=basic.target

Sometimes, this process dies and needs to be restarted. I would like to manage this VPN process through supervisord since I have the remote web interface to supervisorctl.

Would this be something easy to do? Am I missing anything important? The thing that catches me up is that supervisord doesn't specify a way to manage pid files (If I even need to worry about that..)

Could I do something like the following in my supervisor.conf?:

[program:pgateway]
command=/opt/pertino/pgateway/pGateway -f -p /run/pGateway.pid
process_name=%(program_name)s
numprocs=1
directory=/tmp
umask=022
priority=999
autostart=true
autorestart=unexpected
startsecs=10
startretries=3
exitcodes=0,2
stopsignal=TERM
stopwaitsecs=10
stopasgroup=false
killasgroup=false
user=root
redirect_stderr=false
stdout_logfile=/a/path
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10
stdout_capture_maxbytes=1MB
stdout_events_enabled=false
stderr_logfile=/a/path
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=10
stderr_capture_maxbytes=1MB
stderr_events_enabled=false
environment=A="1",B="2"
serverurl=AUTO
Brian Leach
  • 327
  • 3
  • 5
  • 16
  • Going from current systemd to obsolete supervisor? I wouldn't. If you really want a web interface to systemd, it's called [cockpit](https://cockpit-project.org/) and it's in EPEL. As for your immediate problem I'd set `Restart=always` in the systemd unit. – Michael Hampton Jul 31 '18 at 19:51
  • What would I gain by moving the other services to systemd and using cockpit? Worth the hassle? – Brian Leach Jul 31 '18 at 21:17
  • @BrianLeach The question is what would you gain by moving to supervisord? If you already have legacy stuff running under it, that's one thing, but it'll go away eventually, so it would be a good idea to plan for that. Putting new stuff into it, when it already has a workable systemd unit, seems like a very bad idea. – Michael Hampton Jul 31 '18 at 22:54
  • There is more legacy under supervisor. Currently the vpn is the only one that I need to manage remotely that isn't under `supervisord`. Cockpit seems more complete than the ones I saw for supervisor – Brian Leach Jul 31 '18 at 23:32

0 Answers0