Skip to content

Integrating hypnotoad with systemd and rsyslog

jamadam edited this page Feb 6, 2017 · 4 revisions

Integrating hypnotoad with systemd and rsyslog

Hypnotoad config sample:

hypnotoad => {
    pid_file => '/path/to/app/pid/file/my-app.pid',
    # other params...
    # look http://mojolicio.us/perldoc/Mojo/Server/Hypnotoad for more info
},

Systemd service config sample /lib/systemd/system/my-app.service:

[Unit]
Description=My app description
Requires=network.target
After=network.target
# put here other service requirements

[Service]
Type=simple
Restart=always
SyslogIdentifier=my-app
PIDFile=/path/to/app/pid/file/my-app.pid
ExecStart=/usr/bin/hypnotoad /path/to/app/script/my-app -f
ExecStop=/usr/bin/hypnotoad -s /path/to/app/script/my-app
ExecReload=/usr/bin/hypnotoad /path/to/app/script/my-app

Don't forget sudo systemctl --system daemon-reload after creating new systemd service config.

Rsyslog config sample /etc/rsyslog.d/my-app.conf:

if $programname == 'my-app' then /var/log/my-app.log