Skip to content

Instantly share code, notes, and snippets.

@lingqingmeng
Forked from hskang9/failsafe.service
Created June 4, 2019 20:27
Show Gist options
  • Save lingqingmeng/6a43c16ddd03dd34d665a50f1af9bf08 to your computer and use it in GitHub Desktop.
Save lingqingmeng/6a43c16ddd03dd34d665a50f1af9bf08 to your computer and use it in GitHub Desktop.
failsafe script daemon for systemctl
[Unit]
Description=command for running the cosmos node after restart.
ConditionPathExists=/home/ubuntu/go/bin/gaiad
After=network.target
[Service]
Type=simple
User=ubuntu
Restart=on-failure
RestartSec=10
startLimitIntervalSec=60
WorkingDirectory=/home/ubuntu/go/src/github.com
ExecStart= /home/ubuntu/go/bin/gaiad start --home=/home/ubuntu/.gaiad &> gaia2.log & NODE1_PID=$!
PermissionStartOnly=true
ExecStartPre=mkdir -p /var/log/cosmos
ExecStartPre=chown syslog:adm /var/log/cosmos
ExecStartPre=chmod 755 /var/log/cosmos
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=cosmos
[Install]
WantedBy=multi-user.target
@lingqingmeng
Copy link
Author

to Look at status run command and tail the log
sudo journalctl -f -u failsafe

placed in

/etc/systemd/system/gaiad.service

@lingqingmeng
Copy link
Author

sudo journalctl -f -u cosmos-failsafe.service

Command now changed to

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment