Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

execute bash script after successfully start systemd?

I have /etc/systemd/system/tivalue.service with following content:

[Unit]
Description=Ti-Value Node
After=network.target

[Service]
Type=simple
PIDFile=/var/run/tivalue.pid

User=root
Group=root

ExecStart=/root/TiValue/tiValue --rpcuser=admin --rpcpassword=123456 --httpdendpoint=127.0.0.1:8080 --daemon
KillSignal=15
Restart=always

[Install]
WantedBy=multi-user.target

and also /etc/systemd/system/tivalue.curl.sh

So, how can I execute /etc/systemd/system/tivalue.curl.sh after successfully started tivalue.service?

like image 636
Alexandr Bortnik Avatar asked Dec 26 '17 14:12

Alexandr Bortnik


People also ask

How do I run a script as daemon?

We can use systemd unit files to launch our script at boot. Unit files describe how the system should execute the given program. We set the user that the script will run with the User= option and the path to the script with the ExecStart= option. The various options are documented in the systemd.


1 Answers

Use an ExecStartPost= entry pointing at the script. See the ExecStartPre/ExecStartPost documentation.

like image 173
mmlr Avatar answered Nov 03 '22 10:11

mmlr