I am trying to log the applications that a user opens/closes. Is there a way to execute a script (Java,Python,etc) everytime an application (like firefox) is opened and closed?


You can use a wrapper, e.g. possibly called firefox, which can be found earlier in your $PATH. For instance:

[commands executed before Firefox starts]
/usr/bin/firefox "$@"
[commands executed after Firefox quits]
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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