[NTLUG:Discuss] Shell script attaching to an X session?
Daniel Hauck
daniel at yacg.com
Fri May 16 15:35:46 CDT 2008
Here's the scenario:
I'm very interested to know when the nvidia packages for Fedora 9 are
available on the livna repository. My idea was to write a simple shell
script that will check to see if the package files might be there, and
if so, open up a dialog box using zenity announcing it. I would then
launch this script every hour.
The trouble is that the only scheduled task engine I'm aware of is
"cron" and that's for background tasks and not associated with an X
session which is what zenity requires in order to create a dialog box
that works.
Here's my script:
-----
#!/bin/sh
LINECOUNT=`lynx -dump -listonly\
http://livna-dl.reloumirrors.net/fedora/9/x86_64/ | grep -i nvidia | wc\ -l`
# echo $LINECOUNT lines counted with nvidia in it
if [ $LINECOUNT -gt 0 ]
then
echo "nvidia packages detected on livna" > ~/nvidia-report.txt
zenity --info --text="nVidia detected" --title="nVidia detector"\
--timeout=3540
fi
-----
Pretty simple script right? It could probably be done better -- I'm not
that smart.
And the script actually works when I run it from an X session's terminal
window.
Either I need to find an X scheduled task engine or I need to add some
code that will attach itself to my X session so that the dialog box
actually appears.
Ideas?
More information about the Discuss
mailing list