Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

The usual way is to wrap the application in a script


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
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


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.