| {%- if grains.get('init', None) == 'systemd' %} |
| |
| [Unit] |
| Description=heka {{ service_name }} - data collector and processor daemon |
| After=network.target auditd.service |
| ConditionPathExists=!/etc/{{ service_name }}_not_to_be_run |
| |
| [Service] |
| EnvironmentFile=-/etc/default/{{ service_name }} |
| User=heka |
| Group=heka |
| LimitNOFILE=102400 |
| ExecStart=/usr/bin/hekad -config=/etc/{{ service_name }} |
| # NOT SURE HEKA doesn't support reloading by signal |
| # ExecReload=/bin/kill -HUP $MAINPID |
| KillMode=process |
| Restart=on-failure |
| StandardError=inherit |
| |
| [Install] |
| WantedBy=multi-user.target |
| |
| {%- else %} |
| |
| # heka {{ service_name }} |
| |
| description "{{ service_name }}" |
| |
| start on runlevel [2345] |
| stop on runlevel [!2345] |
| |
| respawn |
| |
| pre-start script |
| touch /var/log/{{ service_name }}.log |
| chown heka:heka /var/log/{{ service_name }}.log |
| end script |
| |
| script |
| # https://bugs.launchpad.net/lma-toolchain/+bug/1543289 |
| ulimit -n 102400 |
| exec start-stop-daemon --start --chuid heka --exec /usr/local/bin/{{ service_name }}_wrapper >> /var/log/{{ service_name }}.log 2>&1 |
| end script |
| |
| {%- endif %} |