Re: How to use ``nice'' on a pipe?
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
CaT wrote:
> On Sun, Mar 09, 2008 at 05:34:48PM +0800, Wei Chen wrote:
>> a low priority. How can I make both command1 and command2 on the pipe
>> running in the low priority? Thank you.
>>
>> =================================
>> #!/bin/sh
>> runprogram () {
>> nice -n19 ionice -c2 -n7 "$@"
>> }
>> runprogram command1 | command2
>
> This is one of those, once you see it it'll be the most bleedingly
> obvious things I think. :)
>
> runprogram command1 | runprogram command2
>
> :)
>
That's true :)
In fact I was writing something like the following. Put the following
snippet at the head of the script, so that the whole script gets nice
value properly set...
if [[ $1 != "run-script-nicely" ]]
then
nice -n19 $BASEDIR/$(basename $0) run-script-nicely
exit 0
fi
echo 'original script here...'
But later I found it too strange for me, so I changed to what you have
mentioned... Thank you :)
- --
Cheers,
Wei Chen
http://www.acplex.com/people/wchen/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFH09mQCIqXQV6BF28RAtGPAJ9A9w/+J7ur3OT5/5FDBuEGY5RGaACfa4jD
DUWuOKQ7Uqw2QL3kBU+RwvM=
=S8sA
-----END PGP SIGNATURE-----
Reply to: