This is what I use in my Linux environment. I save the following in
# Graceful exit, like pressing Control-C on a program
killall -q --signal SIGINT geth
# Hard kill, only to stop a process that refuses to terminate
killall -q geth
# Clear IPC as this can sometimes cause problems
rm -f /home/user/.ethereum/geth.ipc
mv /home/user/ethlogs/geth.log /home/user/logarchive/geth.log_$DATE
# Message <= 32 bytes
MESSAGE="BokkyPooBah wuz here!"
# Use 6 for full details
geth --support-dao-fork --rpc --rpcaddr "192.168.7.123" --rpcport 8545 --extradata "$MESSAGE" --verbosity $VERBOSITY 2>> /home/user/ethlogs/geth.log &
chmod 700 /home/user/bin/runGeth.
/etc/rc.local, I add:
sudo -u user /home/user/bin/runGeth
I also restart
geth periodically as I have had several instances where it locks up or dies. I add the following to
# m h dom mon dow command
10 1,7,13,19 * * * sudo -u user /home/user/bin/runGeth
Q: In case no, is it safe to just kill the process and run it again?
The graceful exit for
geth is necessary. I leave some time for
geth to gracefully shut down. I then try a hard kill as
geth has in the past refused to gracefully exit.
I used only the hard kill before and the blockchain data got corrupted.
I also use similar scripts to send me periodic emails that report on the coinbase balance,
ethminer hashrate, GPU temperature, ETH prices and other statistics. And a watchdog script to shutdown
ethminer processes if the GPUs reach a specified temperature.