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.

I would like to have bash script run by screen every time when i attach (start.sh) or detach (end.sh) session.

Is there any way to configure screen to do that?

share|improve this question

1 Answer 1

If you have the scripts, then you can do that. But screen by itself does not have hooks to be called on reattach or detach. There is no event handler system accessible to the user.

However for detach, you might be able to exec commands in on keyboard sequences. For example, bind ^D exec ${HOME}/bin/end.sh; and then have ~/bin/end.sh do what you need and force a detach on the screen session. You might also be able to do this with stuff.

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.