Facilitate ease of use around plotman being run as a service
from #177
My imagination is that
plotman plotwould end up being used as a service and you wouldsystemctl start plotmanandsystemctl stop plotmanetc. You could enable it to start on boot. When it crashed it would be restarted. I presume that would handle log rolling of our output, etc. I don't know a specific reason you couldn't set this up now, but I also haven't actually done it or heard of anyone doing it. This would be significantly more useful with a monitoring version of interactive mode. Or at least aplotman interactive --monitorcli option.
@altendky My issue title here might not be the best
It looks it can be achieved in Linux with relative low effort:
-
plotman plotcontinues to behave as it currently does - We add an extra check to make sure the user isn't trying to start another instance (e.g, different terminals, another process in background etc). This can be done by simply looking at the processes table
- Add a flag
--stopthat kills the process using the PID from the processes table - install to
systemd(see links below)
if I run plotman plot as command inside systemd service and later stop the service with sudo service plotman stop it stops! ALL the plotting jobs!!! started by this command. It was a big surprise for me when plotman status didn't show me 20+ started earlier jobs by this service. Any way to run plotman as a service and not to stop plotting jobs if the service is stopped?
plotman version used: 0.3.1 service config:
[Unit] Description=Plotman Service After=network.target [Service] ExecStart=/home/chia/plotman/plotman.sh WorkingDirectory=/home/chia/plotman StandardOutput=inherit StandardError=inherit Restart=always User=chia [Install] WantedBy=multi-user.target
plotman.sh content
#!/bin/sh
cd /home/chia/chia-blockchain . ./activate
plotman plot 2>&1 | tee /home/chia/plotman/plotman.log
@andrew-kratik, that sounds like a bug to me. Feel free to open a dedicated ticket. Efforts are already made to disassociate the plotting processes from the plotman processes. If that's not working then it should be addressed directly. Maybe you could check if there is a difference between when plotman plot is run directly and then killed as opposed to run by systemd and then killed?
In general, yes, plotman is already somewhat broken up into pieces, but there are lots of pointy corners in that usage. plotman plot doesn't archive. plotman interactive plots. etc... And we'll have to deal with a user mindset shift away from plotman interactive does everything, or make it so it still does.