Scripting GNU Screen with Python
blog.interstellr.com
blog.interstellr.com
Would be interested to hear your other tricks if you ever remember them ;)
Also I've used screen as a poor mans daemon tools to run various apps in the background as a service. I even at one point had a skeleton init script that used screen to run any command as a daemon. I should see if I can find that actually and get it on github so I can find it the next time I need it.
How do you do that? I've tried looking at the documentation for irssi, and it's god-awful.
[edit: see here - http://news.ycombinator.com/item?id=1781074]
source ~/.screenrc
sessionname im
bind ^D eval 'at naim stuff "/away Detached!\012"' 'at irssi stuff "/away Detached!\012"' 'detach'
bind d eval 'at naim stuff "/away Detached!\012"' 'at irssi stuff "/away Detached!\012"' 'detach'
screen -t naim naim
screen -t irssi irssi
and a bash alias alias im='if detached im; then screen -S im -pirssi -X eval "stuff /away\012"; screen -S im -pnaim -X eval "stuff /away\012"; screen -r im; else screen -x im; fi;' ssh -t remote.host.net screen -D -R -S "$(hostname)_$PPID"
Then if/when I lose the connection I hit [Up][Enter] to run the previous command. I get logged back in to the same screen session where my terminal session will still be running.My screen configuration is mostly set up to hide that I'm running screen as much as possible. Rather than using screen's multiple windows I tend to ssh in multiple times and use a tiling window manager to manage the terminal windows. ssh ControlMaster stuff means I can still do everything over one network connection.
PS Whenever screen comes up on HN, someone mentions tmux. I haven't checked it out because my setup works for me, but new users might want to.
screen < tmux < SizeUp (on a Mac)