[ubuntu-uk] VPS hosts

Dave Walker DaveWalker at ubuntu.com
Fri Aug 17 16:42:13 BST 2007


On Fri, 2007-08-17 at 10:54 +0100, Matthew East wrote:
> Hi,
> 
> On 17/08/07, Dave Walker <DaveWalker at ubuntu.com> wrote:
> > Then i simply extracted the irssi executable from either a deb or tar, I
> > can't remember.  To make things easier you can just use mine :)
> 
> Ah, clever: there was me trying to compile the thing, and finding
> missing glib libraries, and getting stuck! That's very useful, thanks!
> 
> > To make connecting easier I use this script:
> 
> Do you do anything to bring screen/irssi back up after the machine is
> rebooted? Or, is there a way to get notified when that happens?
> 

No, but i suppose you could add add a crontjob to check it.  I've
literally just done this, so YMMV - but let me know if it works.   You
will need to setup Irssi to auto-connect. 

I've had a play, and it *almost* works.  The only problem is I can't
seem to get cron to execute 'screen' as it doesn't have a terminal.
I've tried a few ways of getting around it, but so far no joy.  I'll
keep you posted, currently it will just email you.

Testing, I seemed to have a problem calling with the name 'irssi', maybe
'ps' is aware of other users running it.  I don't know, It was easier to
rename irssi to irssa.  Currently you will receive an email to your
dreamhost address, telling you it had to restart.   To stop this,
comment out the obvious.

Make this script and chmod +x it.

$ cat ~/bin/checkirssi
#!/bin/sh
SERVICE='irssa'
if [ -x `ps ax | grep -v grep | grep $SERVICE > /dev/null` ]
then
    #  irssi is not running, better relaunch
       screen -dmS s4i $SERVICE  # doesn't work when launched from cron
       # The following will be emailed to you           
       echo Hi `whoami`.  $SERVICE crashed, needs to be restarted!
fi
### Done


Then add it to cron, the following.  It will check every 5 mins (maybe
excessive?), and then launch screen+irssi if it is not running:

$ crontab -e

*/5 * * * * /bin/sh /home/daviey/bin/checkirssi

(obv. change you account name for home, must be fully qualified (ie ~/
won't work).

Kind Regards,
Dave Walker




More information about the ubuntu-uk mailing list