Vim/lib/systemd/system/jkb.servcie
[Unit]
Description=jkb
After=network.target
[Service]
Type=forking
#PIDFile =/root/jkb_agent/jkb.pid
execstart=/usr/bin/sh/root/jkb_agent/start.sh
execstop=/usr/bin/sh/root/jkb_agent/stop.sh
Privatetmp=true
[Install]
Wantedby=multi-user.target
Systemctl Daemon-reload
Systemctl Enable Jkb.service
Service JKB Status
Redirecting To/bin/systemctl status Jkb.service
Jkb.service-jkb
Loaded:loaded (/usr/lib/systemd/system/jkb.service; enabled)
Active:active (running) since five 2016-01-08 16:26:58 HKT; 2min 27s ago
process:26537 execstop=/usr/bin/sh/root/jkb_agent/stop.sh (code=exited, status=0/success)
process:26617 execstart=/usr/bin/sh/root/jkb_agent/start.sh (code=exited, status=0/success)
Main pid:26621 (Python)
CGroup:/system.slice/jkb.service
├─26621 python jkbmaster.py start
├─26694/usr/bin/python/root/jkb_agent/jkbagent.py 26621
├─28836 snmpwalk-v 3-u-a md5-a-l AUTHNOPRIV 45.116.147.202:161 Sscpurawuser
├─28843 snmpwalk-v 3-u-a md5-a-l AUTHNOPRIV 103.56.195.9:161 Sscpurawnice
├─28844 snmpwalk-v 3-u-a md5-a-l AUTHNOPRIV 103.56.195.10:161 Sscpurawuser
├─28852 snmpwalk-v 3-u-a md5-a-l AUTHNOPRIV 103.56.195.23:161 Sscpurawnice
├─28853 snmpwalk-v 3-u-a md5-a-l AUTHNOPRIV 103.56.195.4:161 Sscpurawnice
├─28854 snmpwalk-v 3-u-a md5-a-l AUTHNOPRIV 103.56.195.12:161 Sscpurawuser
├─28855 snmpwalk-v 3-u-a md5-a-l AUTHNOPRIV 45.116.147.210:161 Sscpurawuser
├─28865 snmpwalk-v 3-u-a md5-a-l AUTHNOPRIV 103.56.195.2:161 Sscpurawnice
├─28870 snmpwalk-v 3-u-a md5-a-l AUTHNOPRIV 103.56.195.22:161 Sscpurawnice
├─28872 snmpwalk-v 3-u-a md5-a-l AUTHNOPRIV 103.56.195.13:161 IFMTU
├─28874 snmpwalk-v 3-u-a md5-a-l AUTHNOPRIV 45.116.147.178:161 Sscpurawuser
├─28877 snmpwalk-v 3-u-a md5-a-l AUTHNOPRIV 45.116.147.186:161 Sscpurawuser
├─28891 snmpwalk-v 3-u-a md5-a-l AUTHNOPRIV 103.56.195.21:161 Sscpurawuser
├─28899 snmpwalk-v 3-u-a md5-a-l AUTHNOPRIV 103.56.195.11:161 Sscpurawuser
├─28904 snmpwalk-v 3-u-a md5-a-l AUTHNOPRIV 45.116.147.218:161 Sscpurawnice
├─28905 snmpwalk-v 3-u-a md5-a-l AUTHNOPRIV 103.56.193.16:161 Sscpurawuser
├─28906 snmpwalk-v 3-u-a md5-a-l AUTHNOPRIV 45.116.147.162:161 Sscpurawuser
├─28915 snmpwalk-v 3-u-a md5-a-l AUTHNOPRIV 103.56.195.15:161 Sscpurawnice
├─28917 snmpwalk-v 3-u-a md5-a-l AUTHNOPRIV 103.56.195.17:161 Sscpurawuser
├─28918 snmpwalk-v 3-u-a md5-a-l AUTHNOPRIV 103.56.195.8:161 Sscpurawuser
├─28919 snmpwalk-v 3-u-a md5-a-l AUTHNOPRIV 103.56.195.20:161 Sscpurawsystem
└─28928 snmpwalk-v 3-u-a md5-a-l AUTHNOPRIV 103.56.195.16:161 Sscpurawuser
January 16:26:58 fortress-new systemd[1]: Started jkb.
PS: Execute program jkb_agent/start.sh and stop.sh it is best not to put the/tmp directory, SYSTEMCTL cannot read the directory:
[Email protected] system]# systemctl status Jkb.service
Jkb.service-jkb
Loaded:loaded (/usr/lib/systemd/system/jkb.service; enabled)
Active:failed (Result:exit-code) since four 2016-01-07 17:58:11 HKT; 22h ago
process:8904 execstart=/tmp/jkb_agent/start.sh (code=exited, status=203/exec)
January 17:58:11 fortress-new systemd[8904]: Failed at step EXEC spawning/tmp/jkb_agent/start.sh:no such file or directory
January 17:58:11 fortress-new systemd[1]: Jkb.service:control process exited, code=exited status=203
January 17:58:11 fortress-new systemd[1]: Failed to start jkb.
January 17:58:11 fortress-new systemd[1]: Unit Jkb.service entered failed state.
Monitoring Bao Intranet collector start.sh add Systemctl boot from boot Jkb.service