-
Notifications
You must be signed in to change notification settings - Fork 26
/
fluentd.service.erb
40 lines (38 loc) · 1.57 KB
/
fluentd.service.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
[Unit]
Description=<%= service_name %>: All in one package of Fluentd
Documentation=https://docs.fluentd.org/
After=network-online.target
Wants=network-online.target
[Service]
<% if pkg_type == 'deb' %>
User=_<%= Shellwords.shellescape(service_name) %>
Group=_<%= Shellwords.shellescape(service_name) %>
<% else %>
User=<%= Shellwords.shellescape(service_name) %>
Group=<%= Shellwords.shellescape(service_name) %>
<% end %>
LimitNOFILE=65536
Environment=LD_PRELOAD=<%= install_path %>/lib/libjemalloc.so
Environment=GEM_HOME=<%= gem_install_path %>/
Environment=GEM_PATH=<%= gem_install_path %>/
Environment=FLUENT_CONF=/etc/<%= package_dir %>/<%= service_name %>.conf
Environment=FLUENT_PLUGIN=/etc/<%= package_dir %>/plugin
Environment=FLUENT_SOCKET=/var/run/<%= package_dir %>/<%= service_name %>.sock
Environment=FLUENT_PACKAGE_LOG_FILE=/var/log/<%= package_dir %>/<%= service_name %>.log
<% if pkg_type == 'deb' %>
EnvironmentFile=-/etc/default/<%= service_name %>
<% else %>
EnvironmentFile=-/etc/sysconfig/<%= service_name %>
<% end %>
PIDFile=<%= Shellwords.shellescape("/var/run/#{package_dir}/#{service_name}.pid") %>
RuntimeDirectory=<%= Shellwords.shellescape(package_dir) %>
Type=forking
# XXX: Fix fluentd executables path
ExecStart=/opt/<%= package_dir %>/bin/fluentd --log $FLUENT_PACKAGE_LOG_FILE --daemon <%= Shellwords.shellescape("/var/run/#{package_dir}/#{service_name}.pid") %> $FLUENT_PACKAGE_OPTIONS
ExecStop=/bin/kill -TERM ${MAINPID}
ExecReload=/bin/kill -HUP ${MAINPID}
Restart=always
TimeoutStopSec=120
[Install]
WantedBy=multi-user.target
Alias=<%= compat_service_name %>.service