Configure a systemd service for OASIS. #13

Open
be1 wants to merge 2 commits from be1/astroport:master into master
1 changed files with 22 additions and 7 deletions

View File

@ -92,11 +92,25 @@ scuttlebutt() {
}
EOF
cat > ~/.zen/launch-oasis.sh <<EOF
#!/bin/bash
oasis --allow-host $nodename --host $nodename
echo "CREATE SYSTEMD oasis SERVICE >>>>>>>>>>>>>>>>>>"
cat > /tmp/oasis.service <<EOF
[Unit]
Description=OASIS Scuttlebutt Gateway
After=network.target
[Service]
User=_USER_
ExecStart=/usr/local/bin/oasis --host _NODENAME_ --allow-host _NODENAME_
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
sed -i "s/_USER_/$USER/g" /tmp/oasis.service
sed -i "s/_NODENAME_/$nodename/g" /tmp/oasis.service
sudo cp -f /tmp/oasis.service /etc/systemd/system/
echo "
_ __ __ _
_ _ .__|_o _ (_ (_ |_)
@ -112,13 +126,14 @@ __)|_| \ \/ |_| \ || || |_ ... SCUTTLEBUTT ... OK?
'
echo "Launching oasis"
oasis --allow-host $nodename --host $nodename &
sudo systemctl daemon-reload || err "Reload systemd"
sudo systemctl enable oasis || err "Enable OASIS daemon"
sudo systemctl start oasis || err "Start OASIS daemon"
echo " http://$nodename:3000 "
echo
echo "ADD ~/.zen/launch-oasis.sh TO YOUR '/etc/rc.local' !!! Or use patchwork. "
sleep $((1 + RANDOM % 5))
echo "LAUNCHING OASIS NODE MANAGER http://$nodename:3000"
echo "IF YOU ARE A PUB consider protect it behind password nginx redirect !!!"
echo "3 seconds before ssb_INIT.sh..."