From: Christian Heller Date: Mon, 12 Oct 2015 00:47:27 +0000 (+0200) Subject: Fix race condition in irssi screen script. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/%7B%7Bdb.prefix%7D%7D/todo?a=commitdiff_plain;h=ce8e37989a146af86ec093c749e02fa2d82a434d;p=config Fix race condition in irssi screen script. --- 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.