Re: Starting X apps from cron


Subject: Re: Starting X apps from cron
From: James Zuelow (e5z8652@zuelow.net)
Date: Wed Aug 07 2002 - 20:04:27 AKDT


On Wed, 7 Aug 2002 09:11:53 -0800
"Christopher Swingley" <cswingle@iarc.uaf.edu> wrote:

> keybindings to make creating new terminals easy, but I'm wondering
> if it's possible to run a cron job that looks for the presence of an
> xterm and / or mozilla, and if none is running, starts one up.
>
> Is this possible?
>

I would think so. Here's a simple script that kind of does what you want:

#!/bin/sh
XT=`ps a | awk '/[x]term/ { print $1 }'`
echo $XT
if [ -z $XT ]
        then # no xterm running
        xterm &
        else
        exit 0
fi

The problem is that it doesn't work if you have two or more xterms running. :( (the [ -z $XT ] returns an error when $XT is a string of numbers like 1158 3342.) It DOES work from cron however, at least if the user who is running X has the script in their crontab.

---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.



This archive was generated by hypermail 2a23 : Wed Aug 07 2002 - 20:03:13 AKDT