3 # This script is part of navit, a navigation system.
4 # It can be used to make sure that navit is only started
5 # once. If navit is already running it will be brought to
8 # Set this to a place where a pidfile should be stored.
9 # Make sure you have write access...
10 PIDFILE="/var/run/navit/navit.pid"
12 # Set this to navit's executable.
15 # Optional: Set this to an alternative configuration file
18 ############################################################
19 ### You should not need to edit anything below this line ###
20 ############################################################
22 function check_wmctrl()
24 which wmctrl > /dev/null
26 if [ $? -ne 0 ] ; then
27 echo "I need the 'wmctrl' program. Exit."
32 function start_navit()
34 if [ "x" != "x$CONFIG" ] ; then
42 echo -n "$pid" > $PIDFILE
44 if [ $? -eq 0 ] ; then
45 echo "Started navit with PID $pid."
48 echo "Could not create pidfile!"
52 # Waiting for navit to close...
58 function check_navit()
60 if [ -f $PIDFILE ] ; then
62 kill -0 $pid 2>/dev/null
63 if [ $? -eq 0 ] ; then
64 echo "Bringing Navit to front"
66 winid=`wmctrl -l -p | grep -e "^[^:blank:]*[:blank:]*[^:blank:]*[:blank:]*$pid[:blank:]*" | sed 's/ .*//'`
75 ### Start of the main script ###