Automating Program Start / Stop - SOLVED

Dana J. Laude kc9aae at bresnan.net
Thu May 18 03:48:38 UTC 2006


Just to follow this up, I found a solution with a bash script and 
kcron.  I need to still tweak the bash script so I don't need 
kcron, but this is working now.

#!/bin/bash
# wd1.sh - automatically start and stop Weather Display every 4 
hours

# NOPROCESS=2

process=WeatherD        # Set program PID Name

cd /home/vskye/wdisplay
./GoWeather.sh &
clear
echo "Starting Weather Display at \c ";date
sleep 14340             # Restart WD every 3 hours and 59 
minutes.

t=`pidof $process`      # Find pid (process id) of $process.
if [ -z "$t" ]          # If process not present, `pidof` returns 
null.
then
 echo "Process $process was not running"
 echo "Nothing killed"
 exit $NOPROCESS
fi

kill -9 $t              # kill process.
sleep 10                # sleep 10 secs to make sure wdisplay is 
done.

exit 0

Dana




More information about the kubuntu-users mailing list