Hi,
How it is possible to run ethminer on Lin in daemon mode?
Regards,
Alex
not sure if it has daemon mode but I use screen:
sudo apt update && sudo apt install screen
screen ethminer
Ctrl + A followed by Ctrl + D will disconnect the screen and leave it running in the background.
or you can start it per /etc/rc.local with /path/to/miner > /where/output/should/be and then you can tail
With screen it kinda works.
It would be good if ethminer has its own daemon mode, though...
I have mine running in a simple systemd unit. Assuming your distro runs
systemd for it's pretty simple and automatically logs stderr/stdout.
Viewable with journalctl.
On Sep 13, 2017 2:20 AM, "Kranky K. Krackpot" notifications@github.com
wrote:
With screen it kinda works.
It would be good if ethminer has its own daemon mode, though...—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/ethereum-mining/ethminer/issues/310#issuecomment-329081232,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACBbnVLym3005xEQN1Nod9QeBElVVim-ks5sh4IfgaJpZM4PSd_N
.
Create a miner bash script like this:
#!/usr/bin/env bash
ps cax | grep ethminer > /dev/null
if [ $? -eq 0 ]; then
echo "Ethminer is already running."
else
echo "Ethminer being launched"
nohup <path-to-ethminer>/ethminer -U \
-S "<your-pool>" -FS "your-fall-back-pool" \
--stratum-protocol 1 --report-hashrate \
-O "$ETH_ADDRESS.$RIGNAME/$MY_EMAIL" -v 9 --farm-recheck 500 \
>> /var/log/miner.log 2>&1 </dev/null & echo $! > /var/run/miner.pid & sleep 10
fi
Then by crontab -e add
@reboot sleep 180 && bash <full-path-to-your-miner-bash-script>
This will start ethminer at boot or you can issue it manually.
If you want to check log simply tail logfile.
@AndreaLanfranchi Will try it, thanks!
Can also add init.d script using 'start-stop-daemon' -
(Debian/Ubuntu example follows)
Copy this to /etc/init.d/ethminer :
https://gist.github.com/bmatthewshea/9a062c092fd673318f8d208ce44f4f51
Update top portion of script ^ as needed.
Execute:
# user you run this under - the log area needs to be owned by that user ('ubuntu' user example):
sudo mkdir /var/log/miners && sudo chown ubuntu:adm /var/log/miners
sudo chown root:root /etc/init.d/ethminer
sudo chmod 755 /etc/init.d/ethminer
sudo update-rc.d ethminer defaults
sudo update-rc.d ethminer enable
sudo systemctl daemon-reload
#and finally, start miner in background:
sudo service start ethminer # or sudo systemctl start ethminer.service
Monitor:
tail -f /var/log/miners/ethminer.log
Please see this: https://gist.github.com/bmatthewshea/6bad5242dbf270ef881c033918b947c0 for a way to monitor* this service for inactivity/restart using a crontab script.
Stop with:
sudo service ethminer stop
or
sudo systemctl stop ethminer.service
* You could also use a tool like Monit (or others) to watch the process/PID for activity and have it restart ethminer service if there's a problem. I choose to do this myself by having a cronjob watch the log file for movement. NOTE/HINT: Watching the PID alone doesn't work if ethminer binary simply stalls and doesn't exit with error - which is almost always the case when it has an issue. Watch the console output/log instead.
Most helpful comment
Create a miner bash script like this:
Then by crontab -e add
@reboot sleep 180 && bash <full-path-to-your-miner-bash-script>This will start ethminer at boot or you can issue it manually.
If you want to check log simply tail logfile.