loh-tar / cpd

A pure bash script to collect copy jobs and start them only if the target drive is not busy by any other job under supervision of cpd
GNU General Public License v2.0
2 stars 1 forks source link

Add option for nice/ionice #6

Open Ambrevar opened 6 years ago

Ambrevar commented 6 years ago

It would be nice if each job's niceness / ioniceness could be tweaked independently. I think that would be easy enough to add.

Not sure nice is needed at all though, I'd say only ionice is relevant here.

loh-tar commented 6 years ago

I recently added nice -n 20 to my personal little rsync backup script. Some default niceness for each started copy job I think is the same as starting cpd with some niceness, right? So I guess that's not what you would like. But my backup script is now less noticeable and I think for cpd would it be a good thing to have a build in niceness too.

Make exact specifications how what has to be implemented. I have put it on the readme todo list.

Ambrevar commented 6 years ago

I did not mean to start the daemon but the jobs with ionice/nice.

For example:

Also note that ionice has scheduling classes such as Idle. Can be very useful.

Note that once a command was started with ionice, its effect cannot be reverted.

Last, I think ionice is Linux-specific. nice is available on most other Unices.

loh-tar commented 6 years ago

I did not mean to start the daemon but the jobs with ionice/nice.

I know, that's why I ask

Some default niceness for each started copy job I think is the same as starting cpd with some niceness, right?

I can't find it in my nice man page but IIRC will the niceness inherited to sub processes

With no option, no need to do anything special.

Sure. That's why I note/ask

But my backup script is now less noticeable and I think for cpd would it be a good thing to have a build in niceness too.

Also note that ionice has scheduling classes such as Idle. Can be very useful.

Please be more specific what do you want

Note that once a command was started with ionice, its effect cannot be reverted.

Why I have to know this while coding your wishes?

Last, I think ionice is Linux-specific. nice is available on most other Unices.

And? What do you try to say? For compatibly reasons forget ionice or do you request some extra hacks to fit the system where it is running?

loh-tar commented 6 years ago

After a short search about all this I found this as my first hit. Looks surprisingly extensive the options.

Now I have got the idea to add an option like -extra/-prefix (please help to find a meaning full and short name/letter) where someone can give what ever he want to some job, e.g.

    cpc -extra'ionice -c2 -n7 nice -n19' foo bar

There is then no cpd command to modify a running job in this topic. But show w/wi displays the PID of each running job, so you can do your changes by the usual way.