File: systemd_service_file.md

package info (click to toggle)
pmacct 1.7.8-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,904 kB
  • sloc: ansic: 110,430; sh: 4,794; cpp: 4,375; python: 3,632; makefile: 525
file content (60 lines) | stat: -rw-r--r-- 1,419 bytes parent folder | download | duplicates (4)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Systemd-Service-File
--------------------------

login to your pmacct collector server get root (sudo -i)
vim /etc/systemd/system/nfacctd-bgp01.service

    [Unit]
    Description=Netflow-BGP-Collector
    After=network-online.target
    Wants=network-online.target
    
    [Service]
    Environment=LD_LIBRARY_PATH=/usr/local/lib
    
    Type=simple
    ExecStart=/usr/local/sbin/nfacctd -f /etc/pmacct/nfacctd-bgp01.conf
    
    KillSignal=SIGTERM
    TimeoutStopSec=30
    KillMode=control-group
    PrivateTmp=true
    
    RemainAfterExit=no
    Restart=on-failure
    RestartSec=30s

    [Install]
    WantedBy=multi-user.target
    

Config-File
--------------------------
Set on the pmacct-configfile (a.e. on /etc/pmacct/nfacctd-bgp01.conf) 
the config-key daemonize to false: 
vim /etc/pmacct/nfacctd-bgp01.conf

    ...
    daemonize: false
    ...
    
Systemd-Commands
--------------------------
`systemctl daemon-reload`

`systemctl enable nfacctd-bgp01`

it will return something like: 
> Created symlink
> /etc/systemd/system/multi-user.target.wants/nfacctd-bgp01.service ->
> /etc/systemd/system/nfacctd-bgp01.service.

some other usefull systemd commands: 
`systemctl status nfacctd-bgp01`
`systemctl start nfacctd-bgp01`
`systemctl stop nfacctd-bgp01`

checkout the logmessages of your systemd service: 
`journalctl -fu nfacctd-bgp01`