Solaris / OpenSolarisThis forum is for the discussion of Solaris and OpenSolaris.
General Sun, SunOS and Sparc related questions also go here.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Thanks for the links. It did give me an idea of what I am trying to achieve.
But, I actually need some help scripting itself, meaning, how I put it in a script. If I can get some handhold in starting to write the script that will be great. If this is not the correct forum for that, please redirect me to the appropriate one. Thanks.
So rooms.out will contain only the rooms we care about right?
seems to me a simple
for i in `cat rooms.out` ; do echo `date` exam is being conducted in $i ; done > Exams.out
would work. if you want the date formatted do a man date and pick how you want.
I think a script that runs that code put in cron to run every half hour would be the perfect solution. the orginization of cron varies from distro to distro so we'll need to know what distro this is to help you with the cron entry
Not if there is a need to maintain the orig. timestamp for rooms that are in use for more than 1/2 hr. -- as implied by the example in the OP.
To my "Where are the timestamps in Exams.out coming from? Can they be re-generated at a later time?", maybe I should add: "Once determined, must they stay the same?"
ah missed that ready for my next hack job?
for i in `cat rooms.out` ; do echo `date` exam is being conducted in $i ; done >> Exams_tmp.out
for i in `cat rooms.out` ; do grep $1 Exams_tmp.out | head -1 ; done > Exams.out
cp Exams.out Exams_tmp.out
Basic logic just in case you need some explaination...
We are appending the current list onto the Exams_tmp.out file (which would contain whatever was in the last round), then take the first instance we find and stick it in the Exams.out (earliest time stamp), then copy the Exams.out to Exams_tmp.out so we are ready next time the script runs.