Keep track of when a script runs
There is a perl script that runs on this webserver whenever a user does something. Is there a way I log when that script runs or do something to track time and the amount of times the script runs?
Thanks, |
You can check appropriate system logs. Since every OS maintains logs at different locations, so it depends upon which OS this webserver has? Also you can check /home/username/.bash_history file to check history of commands run by that user.
|
I should have specified the restrictions I have. The permissions on the server are that one group has access to apache, and a separate group is the only group that has root access. I only have access to my directory and the directory for my website, this is stored on the web server. I could request access to logs, but that could take weeks with Christmas right around the corner. Is there a way to manually log things, like over a 2 day period? Thanks, again.
|
Which distro i.e. operating system is there in webserver? To check, login on webserver and invoke:
Code:
uname -a Also do you want to check script run logs for yourself or any other user? FYI, system logs contains many type of log files (in Linux, common logs are maintained in /var/log/.... directory. In Solaris it's in /var/adm/... directory). Also a webserver may maintain it's logs somewhere else (I am not sure). In the meantime, you can try: Code:
grep <username> /var/log/* |
Thank you very much for the commands. I am able to look up the commands that I have run, but I get a "Permission denied" accessing the specific logs in the log folder. I guess I could just add to that perl script so that the end it concatenates the system time to a file. The company keeps a tight lock on permissions within the server.
Server is Red Hat 4.. 2.6.9-89.ELsmp |
If you do not have permissions, then it cannot help. But still you can do:-
First check /home/username/.bash_history, using (Note: it will not show time of script run, but at least will tell you how many times script has run):- Code:
grep "<scriptname.pl>" /home/username/.bash_history Code:
awk '/<scriptname.pl>/ && /<username>/ {print $0}' /var/log/messages* |
Thank you very much. That was what I was looking for. After much time I finally found it. Thanks again.
|
All times are GMT -5. The time now is 01:15 PM. |