Search code examples
perlmojolicioussystemd

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

Solution

  • I don't know why you would need "reload", Mojolicious performs internal reloads when application code changes. You might replace that to

    /bin/kill -0 $MAINPID
    

    if that line should be there, HUP would be terminal for normal application (unless you handle it differently)