Redhat/CentOS systemd service
Creating new systemd service that starts & stops automatically on every reboot & shutdown
# cat /etc/systemd/system/sayhello.service
[Unit]
Description=Mediation Zone Platform, EC1 service
After=network.target
[Service]
Type=simple #one-shot,forking
User=rayrosli
WorkingDirectory=/home/rayrosli
ExecStart=/home/rayrosli/bin/sayhello.sh
ExecStop=/home/rayrosli/bin/saybye.sh
[Install]
WantedBy=multi-user.target
# systemctl daemon-reload
# cat /etc/systemd/system/sayhello.service
[Unit]
Description=Mediation Zone Platform, EC1 service
After=network.target
[Service]
Type=simple #one-shot,forking
User=rayrosli
WorkingDirectory=/home/rayrosli
ExecStart=/home/rayrosli/bin/sayhello.sh
ExecStop=/home/rayrosli/bin/saybye.sh
[Install]
WantedBy=multi-user.target
# systemctl daemon-reload
# systemctl status sayhello.service
# systemctl enable sayhello.service
# systemctl start sayhello.service
# systemctl stop sayhello.service
NOTE:
>For mediationzone application, use Type=forking.
>ExecStart, ExecStop configured & runs successfully
# systemctl stop sayhello.service
NOTE:
>For mediationzone application, use Type=forking.
>ExecStart, ExecStop configured & runs successfully
0 Comments:
Post a Comment
<< Home