- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How do I start user processes at a lower priority?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2003 08:04 AM
07-22-2003 08:04 AM
Hi Guys,
Thanks in advance for any help you can give me on this problem.
I'm running HP-ux 11.0 on a 4-way L-2000 with 3 processors. The purpose of this server is to run SAS Integrated Technologies, and other various Statistical stuff. I have some SAS developers that are connecting to the server using a client front-end (called Enterprise Guide). These developers are starting processes that are virtually uncontrollable and I have to sometimes logon to the console to kill them. I want the processes to start at a lower priority than all of the system processes so things like backups and telnets are not affected.
The client front-end upon logon connects to a process on the HP-UX box that is started using an init script, as follows:
#!/sbin/sh
#
# Start Enterprise Guide LDAP services
# Created April 09, 2001 by Andrew Penney
# Set environment
# PATH=/sbin:/usr/sbin:/usr/bin:/usr/local/sas8/utilities/bin
# export PATH
# Kill all processes matching a certain name
kill_proc () {
PROCNAME=$1
ps -ef | grep "${PROCNAME}" | grep -v grep | while read PROC; do PID=`echo ${PROC} | awk '{ print $2 }'`
[ ${PID} -gt 0 ] && kill ${PID}
done
}
case "$1" in
'start')
rm /usr/local/SAS_8.2/saslog.log
/usr/local/SAS_8.2/utilities/bin/objspawn -configFile /usr/local/SAS_8.2/utilities/bin/myspawner.cfg &
echo "SAS Enterprise Guide Started."
;;
'stop')
kill_proc "/usr/local/SAS_8.2/utilities/bin/objspawn"
rm /usr/local/SAS_8.2/saslog.log
echo "SAS Enterprise Guide Stoped."
;;
*)
echo "Usage: $0 { start | stop }"
exit 1
;;
esac
exit 0
The init script fires up the SAS process that handles the connection for the clients, which is called the objectspawner. The objectspawner uses the myspawner.cfg file to set it's parameters.
## Objspawn Definitions
dn: sasSpawnercn=production,sascomponent=sasServer,cn=SASKATCHEWAN HEALTH,o=health,c=ca
objectclass:sasSpawner
sasSpawnercn: production
sasDomainName: health.gov.sk.ca
sasMachineDNSName: health90.health.gov.sk.ca
sasOperatorPort: 5307
sasLogFile: /usr/local/SAS_8.2/saslog.log
# sasVerbose:
## Server Definitions
dn: sasServercn=beta,sascomponent=sasServer,cn=SASKATCHEWAN HEALTH,o=health,c=caobjectclass: sasServer
sasCommand: /usr/bin/test.sh /usr/local/SAS_8.2/sas -config /usr/local/SAS_8.2/sasv8.cfg -nonews
sasDomainName: health.gov.sk.ca
sasMachineDNSName: health90.health.gov.sk.ca
sasPort: 5306
sasProtocol: bridge
sasServercn: beta
In the ##Server Definitions sections above, there is a sasCommand line that runs everytime a client connects to the server. The command runs 'test.sh' and passes the 'sas' executable and it's options to the test.sh script:
(I use the test.sh script to set up user variables for database connections)
#!/bin/ksh -p
# test.sh
# Need to quote our arguments w/multiple tokens
#
function quoteme { #arg
if [[ $# -gt 1 ]]; then
quoteme="\"$*\""
else
quoteme=$1
fi
echo $quoteme
}
#
# Set Database environment variables here
#
export ODBCINI=/opt/odbc/odbc.ini
export ODBCHOME=/opt/odbc
export SHLIB_PATH=/usr/lib:/etc/opt/resmon/lib:/opt/odbc/lib
#
# Execute SAS
#
cmd=''
for arg in "$@" ; do
tmp="$(quoteme $arg)";
cmd="$cmd $tmp"
done
eval exec $cmd
I'm not a scripter, so I do not know how to edit these so the user's processes start up with a lower priority than normal.
Would I edit myspawner.cfg
sasCommand: /usr/bin/test.sh nice /usr/local/SAS_8.2/sas -config /usr/local/SAS_8.2/sasv8.cfg -nonews
or would I have to edit my test.sh script to somehow nice the eval exec $cmd?
Thanks again.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2003 08:18 AM
07-22-2003 08:18 AM
Re: How do I start user processes at a lower priority?
I haven't got much time.
You can nice programs on the fly using renice so you do not kill them, also lookinto
rtsched & rtprio
Regards
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2003 08:36 AM
07-22-2003 08:36 AM
Re: How do I start user processes at a lower priority?
SYNOPSIS
nice [-priority_change] command [command_args]
nice [-n priority_change] command [command_args]
also in
SAM--Process Management--Process Control--
Right click on any process and modify nice priority.
The higher the nice value the lower
the priority is...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2003 08:59 AM
07-22-2003 08:59 AM
Re: How do I start user processes at a lower priority?
If I renice the processes all the users have to do is stop and restart their clients and it will flush my renice work and I'm back to the same old problem.
Andrew
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2003 09:15 AM
07-22-2003 09:15 AM
SolutionThis will help :-
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xf0ac72234586d5118ff00090279cd0f9,00.html
The best way is with a small root level script that is run , say every min.
something like this:-
for arg in `ps -fel |grep
do
renice -n +20 ${arg}
done
Rember to set env variables in your script and test in on a non production machine first.
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2003 09:17 AM
07-22-2003 09:17 AM
Re: How do I start user processes at a lower priority?
nice - run a command at nodedefault priority
man nice for more info
or
renice - to change the priority of a running process
man remice for more info
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2003 09:25 AM
07-22-2003 09:25 AM
Re: How do I start user processes at a lower priority?
I found a script that I have used in the past:-
It looks at the PPID and PID and renices them to 39
#!/bin/ksh
# Automatically nice down the ftpbbs universe routines
######################################################
# PJFC 2001
######################################################
# Get parent pids
######################################################
q=`who -u | grep ftpbbs `
p=`who -u | grep ftpbbs | awk '{print $7, $15 }'`
######################################################
# Seperate each pid to a string
######################################################
a=`echo $p | awk '{print $1}'`
b=`echo $p | awk '{print $2}'`
######################################################
# Pick up pid of universe process and nice value
######################################################
y=`ps -efl | grep $a | grep -v grep | grep -v sh | grep root | grep uv | awk '{print $4}'` # PID
z=`ps -efl | grep $a | grep -v grep | grep -v sh | grep root | grep uv | awk '{print $8}'` # Nice value
######################################################
# Check nice value
if [ $z = 20 ]
######################################################
# If nice value = 20 then a restart has occured so nice it down
######################################################
then
renice -n 19 $y
fi
######################################################
# Do it all again for other ftpbbs login
######################################################
w=`ps -efl | grep $b | grep -v grep | grep -v sh | grep root | grep uv | awk '{print $4}'`
x=`ps -efl | grep $b | grep -v grep | grep -v sh | grep root | grep uv | awk '{print $8}'`
######################################################
# Check nice value
if [ $x = 20 ]
######################################################
# If nice value = 20 then a restart has occured so nice it down
######################################################
then
renice -n 19 $w
fi
echo "Renice ran "
exit 1
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2003 12:11 PM
07-22-2003 12:11 PM
Re: How do I start user processes at a lower priority?
Use the nice command when you start the script
you can write other script that will execute
the nice with you original script and finish
his job.
Caesar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2003 01:08 PM
07-22-2003 01:08 PM
Re: How do I start user processes at a lower priority?
Here is how I implemented a solution to my problem...
I created a script called sasfix.sh:
#!/usr/bin/sh
# Script Name: sasfix.sh
# Created By: Andrew Penney
# Date Created: July 22, 2003
#
# Purpose of Script: Due to crazy users writing crappy code I have been
# forced to create this script to 'reprioritize' all
# sas processes to run at a priority level of 39 as
# opposed to 20. This should allow system processes to
# take priority avoiding network latency and backup
# issues.
for arg in `ps -fel |grep sas |grep -v grep|cut -c 15-21`
do
# echo "renicing" ${arg}
renice -n +19 ${arg}
done
(Thanks Paula)
I then set up the crontab to run every 5 minutes. This started to flood my email, so I checked the forums and found the the addition to put in my crontab file to stop the emails:
1,6,11,16,21,26,31,36,41,46,51,55 * * * * /root/scripts/sasfix.sh >/tmp/trace1 2>&1
I had to pipe the output to a file or /dev/null.
Thanks everyone.