Closed tmarkn closed 1 year ago
Thank you so much for these!
I'm by no means a good coder, so these PR are much appreciated :)
Actually, as long as I have you here.... A feature that I'd love to implement is checking the mover status/stopping and resuming as needed.
I've figured out the starting and stopping, that's easy enough, but I haven't found a elegant way to check if the mover is active. I could just start/stop the move automatically, but I'd love some logic in there to check it first.
Do you know of an easy way to check that?
After a bit of digging, there's no inherent way of checking the status of the mover as mover only has two commands start via mover
and stop via mover stop
.
You can, however, check if the mover is running by using ps h `cat /var/run/mover.pid`
.
and will return cat: /var/run/mover.pid: No such file or directory
if it's not running.
From here you can save the state and write it to file if it was running, stop it by executing mover stop
.
Then, start the mover again using mover
if it was running (by reading the previous state in the file, then updating the state in file after starting the mover).
Another thing I found is that if you try to stop the mover using mover stop
, it will tell you if it was running by returning either mover: not running
or mover: stopped
as the last line. When a new stream starts, you can attempt to execute this regardless and if the mover was stopped, you update the file to tell the mover to start again once all the streams have stopped. (see above)
As a side note, you can do the same thing with the parity check and without caring about the status of the parity check since the parity check will check for you regardless. parity.check pause
will only pause if a parity check is running. Similarly, parity.check resume
will only resume if it is paused.
Implemented in pull request #4