Computing.Net > Forums > Unix > Need Help with KornShell script

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Need Help with KornShell script

Reply to Message Icon

Name: ckrieger1
Date: February 12, 2004 at 13:04:18 Pacific
OS: unix
CPU/Ram: ?
Comment:

I need a KornShell script that will, among all the users currently logged on to the system, find a slot of one hour that contains the most number of users. I know how to list all the users currently logged on but how do I do anything with the times that are listed? Please help, thanks.



Sponsored Link
Ads by Google

Response Number 1
Name: mdhmi21
Date: February 15, 2004 at 12:42:45 Pacific
Reply:

Have your script run in a loop and run the following -- date and 'w'. Exit your script after you are done collecting your metrics. Write another little script to parse the output and create a pretty chart.

Mark


0

Response Number 2
Name: cbailey33
Date: February 15, 2004 at 18:49:30 Pacific
Reply:

Here is a short script that may help.
It is very simplistic and you can
concatenate the echo output to a
log file if you wish.

#!/bin/ksh

eval `date '+hour=%H minute=%M second=%S'`

end_hr=`expr ${hour} + 1`

end_time="${end_hr}:${minute}:${second}"

until [ -z ${now_time} -eq ${end_time} ]

do

now_time=`date +%H:%M:%S`

numr=`who | wc -l`

echo "${numr} users are logged on at ${now_time}"

sleep 60
done



0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Need Help with KornShell script

need help with unix script www.computing.net/answers/unix/need-help-with-unix-script/8209.html

Need Help With KSH Script www.computing.net/answers/unix/need-help-with-ksh-script/6747.html

need help with grep.... www.computing.net/answers/unix/need-help-with-grep/7366.html