I would like to run the script in background for ever I hope to help me on this
Main Topics
Browse All TopicsHello
I would like to make real-time log monitoring script
I would like to remove the the file :
/home/user/public_html/cc/
(note : "user" and "/cc/.wysiwygPro_edit_" existes in the line bellow )
once the line below match in log file /usr/local/cpanel/logs/acc
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
It looks as though you are looking for "GET" lines in your log file with the .wysiwygPro_edit_XXXX.php name in the same line, and you want to remove that particular .wysiwygPro_edit_XXXX.php file (and not any others), so you can't hard-code the filename in an environment variable.
My pattern assumes that the GET, HTTP and 200 appear in all lines you want to delete - if not, we can remove those from the sed command.
I do repeat a few lines of code in the script below - you*could* write the checking and deleting bit as a function and just call the function twice, but let's get the code working first!
As you can see, the script does two passes through the file. "tail -f" only prints out the last 10 lines (by default, can make it bigger) of the file, so first we have to go through the entire file to delete any files mentioned before the last 10 lines. We then do the tail -f to follow the end of the file. This will also process out the last 10 lines of the exsiting file, but any .wysiwygPro_edit_XXX files mentioned in those 10 lines will have already been deleted in the "cat" section - those entries will be silently ignored.
Why is it that you see erors just *after* you press submit, however often you check!
The middle of the script says:
fi
fi
# Now "tail -f" the log file to catch new entries
tail -f $InputLogFile | while read line
There should be a "done" after the second "fi", so it should be:
fi
fi
done
# Now "tail -f" the log file to catch new entries
tail -f $InputLogFile | while read line
If you want it to run automatically, then the easiest way is probably to add it to your startup scripts for the machine.
For example, on my Ubuntu machine I have /etc/rc.local - put the above script into a file, e.g. /usr/local/bin/rem_swysiwy
/usr/local/bin/rem_wysiwyg
to /etc/rc.local (before the "exit 0" at the end of the file, and don't forget the "&" at the end of the line). If you don't have /etc/rc.local, then there are other ways to do it. One woudl be to add it to /etc/inittab:
rw:345:respawn:/usr/local/
If you are using a recent Linux, you might be using the "upstart" system to launch programs - I#ve not played with that much, so I hope on of the above methods works!
In all cases, these scritps run when the machine boots up. They don't need anybody to be logged in.
All of the above methods run the script as root.
Business Accounts
Answer for Membership
by: fipocoderPosted on 2009-11-12 at 04:12:15ID: 25803591
You have to rwemove the "echo" to make this work...
This is untestet!!
Select allOpen in new window