I have been running the new helpmenu with the timeout set as per PHV. It works great but. Managment doesn't like the sleeps in ps -ef. The problem is I get 900 sleeps in the process list to make it timeout in 15 minutes.
Is there another way to make the menu timeout without putting processes in the ps -ef over and over again. The sleep's do go away after the process is ended.
helpdesk 11068 1 0 08:28:58 pts/10 0:00 sleep 900
helpdesk 26724 1 0 08:29:21 pts/10 0:00 sleep 900
helpdesk 39534 1 0 08:29:21 pts/10 0:00 sleep 900
helpdesk 56764 1 0 08:22:04 pts/10 0:00 sleep 900
helpdesk 61700 1 0 08:29:20 pts/10 0:00 sleep 900
helpdesk 63294 1 0 08:29:20 pts/10 0:00 sleep 900
helpdesk 72082 124102 0 08:29:21 pts/10 0:00 sleep 900
helpdesk 72360 1 0 08:29:20 pts/10 0:00 sleep 900
helpdesk 76842 1 0 08:29:21 pts/10 0:00 sleep 900
helpdesk 89650 1 0 08:29:20 pts/10 0:00 sleep 900
helpdesk 90338 1 0 08:29:21 pts/10 0:00 sleep 900
helpdesk 96828 1 0 08:29:19 pts/10 0:00 sleep 900
blauenl 109246 44548 0 08:29:23 pts/11 0:00 grep sleep
helpdesk 116730 1 0 08:29:20 pts/10 0:00 sleep 900
This seems to happen everytime you hit enter and the menu redraws. The pid changes and the old one just sits there till the timeout happens. This adds up to many sleeps.
Here is the menu program
# 900 sec is 15 minutes
# 1800 sec is 30 minutes
# Purpase: Help Desk menu
# Name: helpmenu
clear
TIMEOUT=120
while
trap 'print "Problem with Help Desk menu"; exec kill -9 $PPID' HUP INT QUIT STOP
print " Helpdesk Menu Options"
print " 1) Add users"
print " 2) Change password"
print " 3) Check printer status"
print " 4) Delete printer jobs "
print " 5) Reset printer "
print " 6) Show users on the system"
print " 7) Show an account"
print " 8) Clean up IP address"
print " 9) Logout "
print
(sleep $TIMEOUT; kill -15 $$ >/dev/null 2>&1) &
do read SEL?" Option: "; RC=$?
kill -9 $! >/dev/null 2>&1
case "$SEL" in
1)command ;;
etc..........................
esac
done
Is there another way to make the menu timeout without putting processes in the ps -ef over and over again. The sleep's do go away after the process is ended.
helpdesk 11068 1 0 08:28:58 pts/10 0:00 sleep 900
helpdesk 26724 1 0 08:29:21 pts/10 0:00 sleep 900
helpdesk 39534 1 0 08:29:21 pts/10 0:00 sleep 900
helpdesk 56764 1 0 08:22:04 pts/10 0:00 sleep 900
helpdesk 61700 1 0 08:29:20 pts/10 0:00 sleep 900
helpdesk 63294 1 0 08:29:20 pts/10 0:00 sleep 900
helpdesk 72082 124102 0 08:29:21 pts/10 0:00 sleep 900
helpdesk 72360 1 0 08:29:20 pts/10 0:00 sleep 900
helpdesk 76842 1 0 08:29:21 pts/10 0:00 sleep 900
helpdesk 89650 1 0 08:29:20 pts/10 0:00 sleep 900
helpdesk 90338 1 0 08:29:21 pts/10 0:00 sleep 900
helpdesk 96828 1 0 08:29:19 pts/10 0:00 sleep 900
blauenl 109246 44548 0 08:29:23 pts/11 0:00 grep sleep
helpdesk 116730 1 0 08:29:20 pts/10 0:00 sleep 900
This seems to happen everytime you hit enter and the menu redraws. The pid changes and the old one just sits there till the timeout happens. This adds up to many sleeps.
Here is the menu program
# 900 sec is 15 minutes
# 1800 sec is 30 minutes
# Purpase: Help Desk menu
# Name: helpmenu
clear
TIMEOUT=120
while
trap 'print "Problem with Help Desk menu"; exec kill -9 $PPID' HUP INT QUIT STOP
print " Helpdesk Menu Options"
print " 1) Add users"
print " 2) Change password"
print " 3) Check printer status"
print " 4) Delete printer jobs "
print " 5) Reset printer "
print " 6) Show users on the system"
print " 7) Show an account"
print " 8) Clean up IP address"
print " 9) Logout "
(sleep $TIMEOUT; kill -15 $$ >/dev/null 2>&1) &
do read SEL?" Option: "; RC=$?
kill -9 $! >/dev/null 2>&1
case "$SEL" in
1)command ;;
etc..........................
esac
done