Hi!
I just wrote a systemd unit for my linux mining machines that automatically restart the cli wallet daemon 30 seconds after crash.
It also auto start the cli wallet after reboot if the service is enabled.
I am using Arch Linux so this one is placed in /etc/systemd/system/credits.service
[Unit]
Description=Credits wallet daemon
[Service]
Type=simple
ExecStart=/usr/local/bin/creditsd -conf=/home/username/.credits/credits.conf
User=username
Restart=always
RestartSec=30
[Install]
WantedBy=default.target
Replace username with the name of your user.
And here is my credits.conf for mining with 3 threads (my CPU have 4 cores but I leave one core for other tasks)
#Do not use special characters with username/password
rpcuser=your_rpcusername
rpcpassword=your_rpcpassword
rpcport=31050
port=31000
gen=1
genproclimit=3
Enable the service
sudo systemctl enable credits.service
Run the service
sudo systemctl start credits.service
Check status
[ronny@filserver ~]$ credits-cli getinfo
{
"version": 1010000,
"protocolversion": 70001,
"walletversion": 60000,
"balance": 621.00021480,
"privatesend_balance": 0.00000000,
"blocks": 284951,
"timeoffset": 0,
"connections": 16,
"proxy": "",
"difficulty": 0.04698341188396778,
"testnet": false,
"keypoololdest": 1510903654,
"keypoolsize": 1999,
"paytxfee": 0.00000000,
"relayfee": 0.00010000,
"errors": ""
}
So there is 621 CRDS in this wallet at block 284951.
Check mining status
[ronny@filserver ~]$ credits-cli getmininginfo
{
"blocks": 284951,
"currentblocksize": 1157,
"currentblocktx": 1,
"difficulty": 0.04698341188396778,
"errors": "",
"genproclimit": 3,
"networkhashps": 780895.126301053,
"pooledtx": 1,
"testnet": false,
"chain": "main",
"generate": true,
"hashespersec": 10948
}
So it is mining with 10.9 kH/s and total network hashrate is 780.9 kH/s.
Edit: Fixed wrong filename on unit file to credits.service