Jun 19, 05:24 PM
Category  

This little script check to see if irssi is running and if so it attaches to the screen session running irssi. If irssi is not running then it creates a screen session and starts irssi.

##############################
#! /bin/bash
#change from 'ps ax' to 'screen -ls' 
#in the following line by Jeremy Freeman
IRCSCREEN=$(screen -ls | pgrep irssi | wc -l)
if [ $IRCSCREEN = 0 ]
then 
    echo "Starting screen and irssi"
    sleep 2
    screen -S irssi irssi
else
    echo "Attaching to irssi"
    sleep 2
    screen -d -r irssi
fi
##############################

p.s. please excuse the formating. Textpattern does not like whitespaces

Commenting is closed for this article.