Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there any way to automatically assign pre- and post-launch actions to applications in Linux?

Exaple scanario: When I launch Virtualbox, vboxdrv is loaded transparently; when I close Virtualbox, the module gets unloaded automatically.

share|improve this question
    
For this particular scenario, why not just load vboxdrv permanently at boot? –  grawity Mar 28 '12 at 12:07

1 Answer 1

The usual way is to wrap the application in a script

#
pre_action
application
post_action

Then invoke that script instead of invoking the application directly

share|improve this answer
    
Thanks, this is ok with additional signal handling. I am searcing for a more universal solution though. –  tdi Mar 28 '12 at 11:27
1  
A wrapper script is as universal as you can possibly get. You can perform any pre/post action with it, for any program in any system. –  grawity Mar 28 '12 at 12:07

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.