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?

link|improve this question
feedback

1 Answer

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.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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