C3rd
CentOS / RHEL 7 : How to create custom daemon service
Posted: 25 Jul 2018, 13:08pm - WednesdayFirst, create the script you want to run...
# vi /root/firewalld.sh #!/bin/bash iptables -F iptables -LThen make this executable...
chmox u+x /root/firewalld.shthen you need to create the daemon service
# vi /etc/systemd/system/sample.service [Unit] Description=Description for sample script goes here After=network.target [Service] Type=simple ExecStart=/root/firewalld.sh TimeoutStartSec=0 [Install] WantedBy=default.targetdefinitions:
After= : If the script needs any other system facilities (networking, etc), modify the [Unit] section to include appropriate After=, Wants=, or Requires= directives. Type= : Switch Type=simple for Type=idle in the [Service] section to delay execution of the script until all other jobs are dispatched WantedBy= : target to run the sample script inthen cast the commands below:
# systemctl daemon-reload # systemctl enable sample.service # systemctl start sample.service # systemctl rebootafter rebooting, your script should be executed. Reference: https://www.thegeekdiary.com/centos-rhel-7-how-to-make-custom-script-to-run-automatically-during-boot/
Search
Categories
Related Links
- Apache Web Server
- ASP Immigration Services Ltd.
- CentOS Linux
- Color Scheme Picker
- CSS Button Generator
- Deviant Art Account
- Don Tabaniag - GraphiCult
- Jerson Maglasang Weblog
- Joshua Manlunas
- Mark "mungkey" Vicente
- Matt Arnilo Baluyos
- MySQL
- Paul Labis
- PHP
- PrendStar
- Ridvan Baluyos
- Scott Davies
- SEO Fart XML-RPC Ping Tool
- Stripes Generator
- The Hero
- Ubuntu Linux
- Vim Carlo Nabora (DA)
- Wella Maria Hong
- What is my IP?
- Xavier University - Ateneo de Cagayan
- Zabyer Community