Skip to content

Instantly share code, notes, and snippets.

@c29r3
Last active December 9, 2020 00:04
Show Gist options
  • Save c29r3/1107210124872f6f5de5b0fbf240264b to your computer and use it in GitHub Desktop.
Save c29r3/1107210124872f6f5de5b0fbf240264b to your computer and use it in GitHub Desktop.
#!/bin/bash
PROJECT_NAME="sifchain"
BIN_PATH="$HOME/go/bin"
NODED="sifnoded"
echo "------> Creating systemd unit $PROJECT_NAME.service"
tee /etc/systemd/system/$PROJECT_NAME.service > /dev/null <<EOF
[Unit]
Description=$PROJECT_NAME Full Node
After=network-online.target
[Service]
User=$USER
ExecStart=$BIN_PATH/$NODED start
Restart=always
RestartSec=3
#LimitNOFILE=150000
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable $PROJECT_NAME
systemctl start $PROJECT_NAME
systemctl status $PROJECT_NAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment