mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-03-29 11:11:47 +01:00
service restart counter
This commit is contained in:
parent
f3a7cd0fc9
commit
8469e48199
@ -32,6 +32,10 @@ if [ ${bitcoinActive} -eq 0 ] || [ ${#bitcoinErrorFull} -gt 0 ]; then
|
||||
echo "*****************************************"
|
||||
echo "If you just started some config/setup, this might be OK."
|
||||
echo
|
||||
if [ ${startcountBlockchain} -gt 1 ]; then
|
||||
echo "${startcountBlockchain} RESTARTS DETECTED - ${network}d might be in a error loop"
|
||||
echo
|
||||
fi
|
||||
if [ ${#bitcoinErrorFull} -gt 0 ]; then
|
||||
echo "More Error Detail:"
|
||||
echo ${bitcoinErrorFull}
|
||||
@ -73,6 +77,10 @@ elif [ ${lndActive} -eq 0 ] || [ ${#lndErrorFull} -gt 0 ]; then
|
||||
echo "*********************************"
|
||||
echo "If you just started some config/setup, this might be OK."
|
||||
echo
|
||||
if [ ${startcountLightning} -gt 1 ]; then
|
||||
echo "${startcountLightning} RESTARTS DETECTED - ${network}d might be in a error loop"
|
||||
echo
|
||||
fi
|
||||
if [ ${#lndErrorFull} -gt 0 ]; then
|
||||
echo "More Error Detail:"
|
||||
echo ${lndErrorFull}
|
||||
|
@ -65,10 +65,10 @@ fi
|
||||
sudo chmod 777 ${infoFile}
|
||||
|
||||
# resetting start count files
|
||||
echo "SYSTEMD RESTART LOG: blockchain (bitcoind/litecoind)" > /home/admin/blockchain.systemd.log
|
||||
echo "SYSTEMD RESTART LOG: lightning (LND)" > /home/admin/lightning.systemd.log
|
||||
sudo chmod 777 /home/admin/blockchain.systemd.log
|
||||
sudo chmod 777 /home/admin/lightning.systemd.log
|
||||
echo "SYSTEMD RESTART LOG: blockchain (bitcoind/litecoind)" > /home/admin/systemd.blockchain.log
|
||||
echo "SYSTEMD RESTART LOG: lightning (LND)" > /home/admin/systemd.lightning.log
|
||||
sudo chmod 777 /home/admin/systemd.blockchain.log
|
||||
sudo chmod 777 /home/admin/systemd.lightning.log
|
||||
|
||||
# Emergency cleaning logs when over 1GB (to prevent SD card filling up)
|
||||
# see https://github.com/rootzoll/raspiblitz/issues/418#issuecomment-472180944
|
||||
|
@ -13,6 +13,7 @@ User=bitcoin
|
||||
Group=bitcoin
|
||||
Type=forking
|
||||
PIDFile=/home/bitcoin/.bitcoin/bitcoind.pid
|
||||
ExecStartPre=-/home/admin/config.scripts/blitz.systemd.sh log blockchain STARTED
|
||||
ExecStart=/usr/local/bin/bitcoind -daemon -conf=/home/bitcoin/.bitcoin/bitcoin.conf -pid=/home/bitcoin/.bitcoin/bitcoind.pid
|
||||
KillMode=process
|
||||
Restart=always
|
||||
|
@ -10,6 +10,7 @@ After=bootstrap.service
|
||||
User=bitcoin
|
||||
Group=bitcoin
|
||||
Type=simple
|
||||
ExecStartPre=-/home/admin/config.scripts/blitz.systemd.sh log blockchain STARTED
|
||||
ExecStart=/usr/local/bin/litecoind -daemon -conf=/home/bitcoin/.litecoin/litecoin.conf
|
||||
KillMode=process
|
||||
Restart=always
|
||||
|
@ -10,6 +10,7 @@ After=bitcoind.service
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=/mnt/hdd/raspiblitz.conf
|
||||
ExecStartPre=-/home/admin/config.scripts/blitz.systemd.sh log lightning STARTED
|
||||
ExecStart=/usr/local/bin/lnd --externalip=${publicIP}:${lndPort}
|
||||
PIDFile=/home/bitcoin/.lnd/lnd.pid
|
||||
User=bitcoin
|
||||
|
@ -28,6 +28,14 @@ echo "tempCelsius='${tempC}'"
|
||||
uptime=$(awk '{printf("%d\n",$1 + 0.5)}' /proc/uptime)
|
||||
echo "uptime=${uptime}"
|
||||
|
||||
# count restarts of bitcoind/litecoind
|
||||
startcountBlockchain=$(cat systemd.blockchain.log | grep -c "STARTED")
|
||||
echo "startcountBlockchain=${startcountBlockchain}"
|
||||
|
||||
# count restarts of bitcoind/litecoind
|
||||
startcountLightning=$(cat systemd.lightning.log | grep -c "STARTED")
|
||||
echo "startcountLightning=${startcountLightning}"
|
||||
|
||||
# is bitcoind running
|
||||
bitcoinRunning=$(systemctl status ${network}d.service 2>/dev/null | grep -c running)
|
||||
echo "bitcoinActive=${bitcoinRunning}"
|
||||
|
19
home.admin/config.scripts/blitz.systemd.sh
Normal file
19
home.admin/config.scripts/blitz.systemd.sh
Normal file
@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
# command info
|
||||
if [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||
echo "additional systemd services"
|
||||
echo "blitz.systemd.sh log blockchain STARTED"
|
||||
echo "blitz.systemd.sh log loghtning STARTED"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# check parameter
|
||||
if [ "${1}" != "log" ]; then
|
||||
echo "# FAIL: unkown parameter"
|
||||
fi
|
||||
|
||||
# writing log file entry
|
||||
logFile="/home/admin/systemd.${2}.log"
|
||||
echo "${3} $(date +%s)" >> ${logFile}
|
||||
echo "# OK: log '${3}' written to ${logFile}"
|
Loading…
x
Reference in New Issue
Block a user