duino-coin icon indicating copy to clipboard operation
duino-coin copied to clipboard

The miner scripts don't like to have their output redirected.

Open cregist opened this issue 5 years ago • 8 comments

duino-coin]$ python3 PC_Miner.py >~/test Traceback (most recent call last): File "/home/craig/duino-coin/PC_Miner.py", line 1192, in title(getString("duco_python_miner") + str(minerVersion) + ")") File "/home/craig/duino-coin/PC_Miner.py", line 195, in title print("\33]0;" + title + "\a", end="") File "/usr/lib/python3.9/site-packages/colorama/ansitowin32.py", line 41, in write self.__convertor.write(text) File "/usr/lib/python3.9/site-packages/colorama/ansitowin32.py", line 162, in write self.write_and_convert(text) File "/usr/lib/python3.9/site-packages/colorama/ansitowin32.py", line 184, in write_and_convert text = self.convert_osc(text) File "/usr/lib/python3.9/site-packages/colorama/ansitowin32.py", line 257, in convert_osc winterm.set_title(params[1]) AttributeError: 'NoneType' object has no attribute 'set_title'

cregist avatar Apr 22 '21 14:04 cregist

what is the problem here? why are you launching it in a weird way?

revoxhere avatar Apr 22 '21 15:04 revoxhere

I had the same problem running it as a system service in Linux so added an argument that switched off the title sections of the code when running in "daemon" mode.

xscode avatar Apr 22 '21 15:04 xscode

I was trying to write a cron script to start the miners on startup, and i want to be able to copy the output to a log file.

cregist avatar Apr 22 '21 16:04 cregist

If you can wait until late tonight (gmt) I'll post my systemd service file and modded PC_Miner.py for you to try. It outputs everything to /var/log/pc_miner.log too.

xscode avatar Apr 22 '21 17:04 xscode

Thanks. That would be appreciated I was trying to get stuff piped to a log that I could tail.

cregist avatar Apr 22 '21 21:04 cregist

Put the pc_miner.py into the duino-coin folder (presumably ~/duino-coin ,if not then edit the paths in the service file). Copy the service file in the systemd service folder and enable it. Run with systemctl as standard. Any other help you need, you can get me in the official Discord server as StuW. pc_miner systemd.zip

xscode avatar Apr 22 '21 22:04 xscode

I have the same problems, too. It could be that the codes, as a whole,overly bloated. This could jammed the server occasionally, if this is a client-server model, I'm not sure. Peer to peer model could be jammed more easily too.

tanengtiong0918 avatar Apr 24 '21 05:04 tanengtiong0918

If someone else wants to miner be started on boot, here is my solution: I made script called start.sh in my home folder with this content: cd /home/pi/duino-coin && python3 PC_Miner.py and created /lib/systemd/system/miner.service file with this content:

[Unit]
Description=DinoMiner service
After=network.target

[Service]
Type=simple
ExecStart=/bin/bash /home/pi/start.sh
Restart=always
RestartSec=5
TimeoutSec=60
RuntimeMaxSec=infinity
PIDFile=/tmp/nome_script.pid

[Install]
WantedBy=multi-user.target

After that in my terminal: sudo systemctl daemon-reload

sudo systemctl enable miner.service

sudo systemctl start miner.service

Check that your miner is running properly by running this command and checking the logs: journalctl -u miner.service -b

mishailovic avatar Jan 01 '22 17:01 mishailovic