|
#9
| ||||
| ||||
| what are you looking to do with this script? what you like it to show?
__________________ ON THE WAY: 15" PB 1.67|100|1024 --- 10.4 ------------------------------------------ 17" iMac G5 1.8|80|512|BT --- 10.3.9 FrankenMac G4 500|55|640 --- 10.3.9 PowerMac 9600 300|4|512 --- 1.2 eMachine 500is 500|4.3|196 --- OpenStep 4.2 Server 2.3|260|512 --- FedoraCore |
|
#10
| |||
| |||
| Initially, I wanted a script to extract from a file that I name, the size of the file and last time it was modified. Then I remembered that someone posted a command line equivalent to "Get Info" in the Finder. I've searched the forums and can't find the thread. I thought I could piece some code together to do what I need it to do. I just need a script to determine whether or not a text file has anything in it, if it does, then the script needs to check the last time it was modified, let's say 20 minutes. If the file is empty, the script does nothing, other than check the text file again in 20 minutes via running as a cron job. The reason I'm doing this is for a project at work. Part of my job is to maintain four Open Access (anyone can use the equipment) NMR laboratories. The Varian NMR instruments (http://www.varianinc.com/cgi-bin/nav...&cid=IJQMIQJFO) are controlled by Sun Microsystems workstations running Solaris 8. These instruments are completely automated (http://www.varianinc.com/cgi-bin/nav...&cid=IJQMIJLFP) with very fast robotics. A previous employee wrote a series of shell scripts that does quite a bit more, sorry I don't want to say what they do for fear of breach of confidentiality. Pharmaceutical companies are very protective of methods developed in-house to streamline, make research more efficient, and less costly. Occasionally, this Varian software just silently stops running and no experiments are running-that costs A LOT OF MONEY WHEN THEY SIT IDLE, I suggested to my supervisor that a shell script be written that runs as a cron job to check a text file over a specified time frame. The script's job is to detect when the Varian automation software and hardware hangs up. Code already exists in other shell scripts on what to do when an error occurs. Late Friday afternoon my supervisor said that if I can't write the code, he can find someone who can, he just needs from me a logic diagram of the program to give to someone else. And I can't post a diagram here without giving away other parts of the custom shell scripts that do everything else. I'm stuck between a rock and a hard place. I don't want to depend too much on other people, because this is a good learning experience, and I want to do as much of it myself as I can. I like programming, I just don't know enough about C/C++ or shell scripts. About 14 years ago, I wrote a report generator for the hospital department I was working in, to finance my college education. The medical reports up to that time were recorded on dictation equipment, and a secretary had to listen to the dictation cassettes and type EVERYTHING on the tape. I said "I can make this whole process much more efficient", not even knowing if I could do it. One year later, a magnificent series Word Perfect Macros, the "Report Generator" was completed. My supervisor implemented it, report turn-around times decreased substantially, reports were made more efficiently, Vice Presidents were notified, and hospital programmers used my Report Generator as a model for other departments. In the end, I got an excellent job review, a letter of commendation placed in my employee file, and I was the "wiz kid" of the department until I left. Last edited by chemistry_geek; February 22nd, 2004 at 09:33 PM. |
|
#11
| |||
| |||
| simple cron job hey, put the following code into a file called checkq.sh. Code: #!/bin/bash
el1=`cat lastenterq`
dl1=`cat lastdoneq`
# this assumes you are only looking for line changes. not changes in lines.
# use bin/diff for that
el0=`wc -l enterq|awk '{print $1}'`
dl0=`wc -l doneq|awk '{print $1}'`
# of course, you prolly want to get an email or something.
if [ $dl1 == $dl0 ] ; then echo "Done q has not changed in 20 minutes" ; fi
if [ $el1 == $el0 ] ; then echo "Enter q has not changed in 20 minutes" ; fi
echo `wc -l doneq|awk '{print $1}'` > lastdoneq
echo `wc -l enterq|awk '{print $1}'` > enterdoneq Code: 0,20,40 * * * * checkq.sh Quote:
Last edited by sdeleurme; February 26th, 2004 at 05:11 PM. Reason: forgot about solaris |
|
#12
| |||
| |||
| Thank you very much for the reply. I will give this script a try. I learned earlier this week that Solaris uses the Bourne shell, don't know if that makes a difference. Prolly so. Also, I been thinking of some other features to add to the script in which case this shell script project will likely be handed off to one of the site programmers. |
![]() |
| Thread Tools | |
|
|