[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] Perl script to check process
- Subject: [ale] Perl script to check process
- From: tim at cliftonfarm.org (Tim Watts)
- Date: Mon, 09 Jan 2012 11:50:28 -0500
- In-reply-to: <1569811632-1326123072-cardhu_decombobulator_blackberry.rim.net-987192411-@b25.c4.bise6.blackberry>
- References: <1569811632-1326123072-cardhu_decombobulator_blackberry.rim.net-987192411-@b25.c4.bise6.blackberry>
Does it have to be Perl? It's simple enough to do in bash:
#!/bin/bash
while ((1)); do
if (ps -fe | grep -v "grep" | grep -P "\Wxboard\W??" >/dev/null); then
{your-start-invocation-here}
fi
sleep 30
done
Would need to refine that 2nd grep if you get more than one hit.
Alternatively, create a pid file when you invoke xboard and grep for
that pid.
On Mon, 2012-01-09 at 15:31 +0000, johnpollock at bellsouth.net wrote:
> Am hoping someone that knows perl can help..
>
> I have chess program I run as a bot, the program is called xboard.
>
> What I'm hoping to accomplish is acquire a perl script that would
> check if it is running and if not restart it.
>
>
>
> Thank you,
> JP
> Sent via BlackBerry by AT&T
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part
Url : http://mail.ale.org/pipermail/ale/attachments/20120109/e95d0d01/attachment-0001.bin