Results 1 to 3 of 3
I'm trying to create a login script for someone who is not familiar with linux at all. Basically what I want it to do is, on login, check to see ...
- 03-13-2010 #1Just Joined!
- Join Date
- Mar 2010
- Posts
- 3
Checking for Exisiting Screen+Irssi Sessions on login
I'm trying to create a login script for someone who is not familiar with linux at all. Basically what I want it to do is, on login, check to see if there is an existing Screen session (named <pid>.irssi) and if there is, attach to it (screen -x irssi), and if there isn't, launch a screen session and irssi inside of the screen.
The purpose of the script is so that my friend, who is a windows user, can launch a batch file in windows that launches putty, connects to my server and automatically displays an active irssi session. If there isn't one running (after a reboot or something), i want it to launch one now.
Anyone know how I can do this? I tried for an hour last night, but couldn't quite figure out how to do it.
- 03-16-2010 #2Just Joined!
- Join Date
- Mar 2010
- Posts
- 3
No responses yet, so i thought i'd post a little more.
There is a screen command that shows what screens are currently active:
corey@terra ~ $ screen -list
There is a screen on:
7601.irssi (Attached)
1 Socket in /var/run/screen/S-corey.
corey@terra ~ $
So, is there a way to put in a script that if there's nothing matching *irssi in the above list, then to execute a command? This is where i'm lost.
- 03-16-2010 #3Just Joined!
- Join Date
- Mar 2010
- Posts
- 3
Alright, came up with a simple script to do this. For anyone interested:
Code:#!/bin/bash num=`screen -list | grep irssi | wc -l` if [ "$num" -eq "0" ] then echo "No screen+irssi session found" else echo "Screen+Irssi session found" fi


Reply With Quote