Need Help with KornShell script

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?

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.

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


See Also
Unix Administrator Career Path

Have a Unix Problem
Do you have a UNIX Question?

Unix Books :-
UNIX Programming, Certification, System Administration, Performance Tuning Reference Books

Return to : - Unix System Administration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.
The site www.gotothings.com is in no way affiliated with or endorsed by any company listed at this site.
Any unauthorised copying or mirroring is prohibited.