Hi, A script is needed which comments the second line of the file and removes ones condition is fulfilled..
Do you actually want to CHANGE the contents of the file, as in "comment" a line, or just execute the if statement's action clause?
For example as mentioned down, I'm checking for the free memory, when it comes to some 50MB it should the comment the '#' at second line of the file
Do you realize this isn't how memory statistics work in UNIX? You can have 100k of memory available via free without having any kind of a memory shortage or problem. When UNIX allocates memory pages they are never released until they are needed (it is a 'lazy' strategy). so "free" doesn't mean what it first seems. Only paging activity indicates a shortage of memory.
Regards,
Komal
/service/run and when the free memory comes to 200 it should remove '#' killing the process or perl. The script below is incomplete..
Please do respond it urgently.. Thanks in advance
#!/bin/bash
echo RAM=`grep MemFree /proc/meminfo|tr -s [:blank:]|cut -f2 -d" "` echo SWAP=`grep SwapFree /proc/meminfo|tr -s [:blank:]|cut -f2 -d" "` echo PID=`pidof perl` if [ $RAM le= 563200 ] then wall "Free Memory is at 100" elif [ $RAM=530432 ] fi
Regards, Raghunandan
Raghunandan Rao Kanugo, System Administrator (Linux), Hyderabad, AP
Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com