source: trunk/Proxy/java-runner.sh @ 869

Revision 869, 1.0 KB checked in by speck, 3 years ago (diff)

Improve restart script because "launchctl stop" immediately relaunches the daemon. Now it uses "launchctl unload".

  • Property svn:executable set to *
Line 
1#!/bin/sh
2
3cd "`dirname "$0"`" > /dev/null
4
5PLIST=/Library/LaunchDaemons/org.glimmerblocker.proxy.plist
6
7if [ -e $PLIST ]
8then
9    RUNNING=1
10    echo "# temporary stops java server"
11    sudo launchctl unload $PLIST
12    while kill -0 $PID 2> /dev/null
13    do
14        echo ".\c"
15        sleep 0.5 # darwin can fract sleep
16    done
17    echo " now stopped"
18else
19    RUNNING=0
20    echo "# server not running"
21fi
22
23./install.sh
24
25PP=/Library/PreferencePanes/GlimmerBlocker.prefPane
26codesign -f -s GlimmerBlocker "$PP/Contents/GlimmerBlockerUpdater.app/Contents/Frameworks/Sparkle.framework/Versions/A"
27codesign -f -s GlimmerBlocker "$PP/Contents/GlimmerBlockerUpdater.app"
28codesign -f -s GlimmerBlocker "$PP/Contents/GlimmerBlockerProxy.app"
29codesign -f -s GlimmerBlocker "$PP"
30
31if [ "$RUNNING" -eq 0 ]
32then
33    exit
34fi
35
36echo "# restarts java server\c"
37sudo launchctl load $PLIST
38while true
39do
40    echo ".\c"
41    PID=`sudo launchctl list org.glimmerblocker.proxy 2> /dev/null | perl -ne 'print $1 if m/\"PID\" = (\d+);/;'`
42    if [ "$PID" ]
43    then
44        echo " pid = $PID"
45        exit
46    fi
47    sleep 0.5
48done
49
Note: See TracBrowser for help on using the repository browser.