---Services Commands---

######################### ######---CentOS 6---##### #########################

service httpd status ##check the status of httpd to see if it is running

service httpd start ##start the httpd service, 'start' can be replaced by 'stop' or 'restart', 'restart' is handy for 'network' service

chkconfig ##show services start-up behavior

chkconfig httpd on ##set 'httpd' service to start during boot

chkconfig httpd off ##set 'httpd' service to not start during boot

########################## #######---CentOS 7---##### ##########################

systemctl status httpd ##check the status of httpd to see if it is running

systemctl start httpd ##start the httpd service, 'start' can be replaced by 'stop' or 'restart', 'restart' is handy for 'network' service

systemctl enable httpd ##on computer start-up start this service

systemctl is-enabled httpd ##see if this service is enabled at system start-up

systemctl list-unit-files --type=service ##show a list of the status of all services

systemctl daemon-reload ##reload the systemd daemon, after you change any of the services config, restart the daemon

######################################### #######---Manually Create Service---##### #########################################

setup a service for nfsen, touch this file in /etc/systemd/system/nfsen.service, add the config below

after service is added run systemctl daemon-reload and start the service

[Unit] Description=Nfsen Daemon After=network.service

[Service] ExecStart=/opt/librenms/html/nfsen/bin/nfsen start ExecStop=/opt/librenms/html/nfsen/bin/nfsen stop ExecReload=/opt/librenms/html/nfsen/bin/nfsen reload Type=forking

[Install] WantedBy=default.target

setup a service for softflowd, touch this file in /etc/systemd/system/softflowd.service, add the config below

[Unit] Description=Softflowd Daemon After=network.service

[Service] ExecStart=/usr/local/sbin/softflowd -v 9 -i eth0 -n localhost:9995 -T full -d ExecStop=ps -ef | grep [s]oftflowd | awk '{print $2}' | xargs kill Type=simple

[Install] WantedBy=default.target