Synergysの再起動

動けばOK牧場
?はバックスラッシュ

set theConfFile to "~/.synergy_home.conf"
set theOfficeIp to "xxx.xxx.xxx.xxx"

try
        set theCmd to "ps -x|grep synergys|grep -v grep|"
        set theCmd to theCmd & "perl -ne '/^??s*(??d+)??s+/;print $1;'"
        set thePid to do shell script (theCmd)
        do shell script ("/bin/kill " & thePid)
on error
end try

try
	do shell script ("/sbin/ifconfig|usr/bin/grep ?"" & theOfficeIp & "?"")
	set theConfFile to "~/.synergy_office.conf"
on error
end try

do shell script "/usr/local/bin/synergys  -n $(hostname -s) --config " & theConfFile