Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reload the mojolicious built-in webserver daemon?

I copied this systemd service file from the lighttpd-package and adapted it to make systemd start the mojolicious built-in server daemon. Can I keep the ExecReload and the KillSignal setting for the mojolicious daemon?

[Unit]
Description=Start mojolicious.pl daemon
After=syslog.target network.target

[Service]
ExecStart=/path/to/mojolicious.pl daemon --listen "http://*:3001"
ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGINT

[Install]
WantedBy=multi-user.target
like image 241
sid_com Avatar asked Dec 16 '22 22:12

sid_com


1 Answers

I think Alex is thinking of morbo when he says it auto-reloads. For production you'd be better using hypnotoad. If you do switch to hypnotoad then there are various signals that will be useful. For example /bin/kill -USR2 $MAINPID will do a graceful reload, avoiding upset to any current connections. For more signals (for hypnotoad) see http://mojolicio.us/perldoc/Mojo/Server/Hypnotoad#SIGNALS

like image 105
niczero Avatar answered Dec 27 '22 11:12

niczero