On 3/9/08, Wei Chen <[EMAIL PROTECTED]> wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> I usually use ``nice'' and ``ionice'' to run a program in a low
> priority. But with the following script, I only get command1 running in
> 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
> =================================
>
> - --
> Cheers,
>
> Wei Chen
> http://www.acplex.com/people/wchen/
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
>
> iD8DBQFH0684CIqXQV6BF28RAvhkAKDFHHCqrBivZ76qx7rYDnXjRrF4OgCeKVcm
> ra/9VH1h5yS0vQtU5MnrEQI=
> =Gqpw
> -----END PGP SIGNATURE-----
>
>
>
> --
> To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> with a subject of "unsubscribe". Trouble? Contact
> [EMAIL PROTECTED]
>
>
Hey,
One way to do this would be to use a named pipe (fifo) and run the two
commands separately at your chosen nice level.
$ apropos fifo
fifo (4) - first-in first-out special file, named pipe
fifo (7) - first-in first-out special file, named pipe
mkfifo (1) - make FIFOs (named pipes)
pipe (7) - overview of pipes and FIFOs
cheers,
Owen.