From ce8e37989a146af86ec093c749e02fa2d82a434d Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Mon, 12 Oct 2015 02:47:27 +0200 Subject: [PATCH] Fix race condition in irssi screen script. --- bin/screen-irssi.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/screen-irssi.sh b/bin/screen-irssi.sh index 1e61f46..3c3d7c8 100755 --- a/bin/screen-irssi.sh +++ b/bin/screen-irssi.sh @@ -6,10 +6,13 @@ while [ $online -eq 0 ]; do ping -q -w 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` > /dev/null && \ online=1 || online=0 done -echo 1 -# Start irssi in shell in screen. +# Start shell in screen, wait until it's created, then start irssi in it. screen -d -m -S irssi +screen_available=0 +while [ $screen_available -eq 0 ]; do + screen_available=`screen -list | grep irssi | wc -l` +done screen -S irssi -X stuff 'irssi\n' # Send mail to remind user to re-identify to NickServ. -- 2.30.2