Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need to find out the history of a script execution in my Linux box. I need to know, how many times it was restarted, by who and when. This is not a system process. This is a ksh script.

Is there any way to do this? Thanks for any help.

----- Update

Ok, I get it that I cant retrospectively get all the data that I had initially asked for. However, could I even get how many times this ksh was run and when? I know the user that runs it.

Thanks for any help.

share|improve this question
1  
No, you can't, at least not in any way reliable. –  Sven Jun 26 at 13:18

2 Answers 2

Without real auditing activated, in the general case the answer will be that this is not possible.

If the users you are concerned about cannot change the script, you easily can add a very simple logging function with the help of the logger command.

Add a line like the following to your script:

logger Myscript was run by user $USER
share|improve this answer

You can't do this retrospectively unless you had auditing enabled. Going forward you could enable auditing or you could modify the script to log it's activity.


Update for your update:

If you know the user you may get something out if their ~/.bash_history but it's not really a good place to look as it is easily edited and bypassed see here. Auditing on the other hand is much more difficullt to tamper with.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.