How to set the process priority for an su - <username> -c <comman d> command

From: Williams, David J <David.J.Williams_at_au.faulding.com>
Date: Mon, 08 May 2000 19:10:46 +0930

I was wondering if anyone knows how to run a user's crontab jobs at a
priority other than the default priority.

The /var/adm/cron/queuedefs file states that the default nice value for cron
events is 2.

We would like to be able to schedule the execution of scripts from the
batchjob user account with a priority higher than 2.

We have thought of issuing a command such as follows from the root account
but this doesn't seem to work:
/usr/bin/nice -n -2 su - batchjob -c 'sleep 100'

This always seems to result in the following process:
# ps -A -o user,pid,ppid,nice,command|grep -v grep|grep -E 'sleep|USER'
USER PID PPID NI COMMAND
batchjob 26385 9729 0 sleep 100

The sleep command, used as an example, is running under the batchjob account
but with a priority of 0.

Running this from root's crontab generates the same result:
26 18 * * * /usr/bin/nice -n 2 su - batchjob -c 'sleep 100'

# ps -A -o user,pid,ppid,nice,command|grep -v grep|grep -E 'sleep|USER'
USER PID PPID NI COMMAND
batchjob 18755 27406 0 sleep 100
root 27406 608 0 sh -c /usr/bin/nice -n 2 su - batchjob -c 'sleep
100'

Any help would be greatly appreciated.

Please respond directly to me and I will summarise.

T.I.A.

David

David J Williams
Technical Specialist
Information Services
F H Faulding & Co Limited
Tel: +61 8 8408 3450/ Fax: +61 8 8408 3500
mailto:david.j.williams_at_au.faulding.com
<mailto:david.j.williams_at_au.faulding.com>
http:www.faulding.com
Received on Mon May 08 2000 - 09:40:52 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:40 NZDT