Created
February 27, 2014 18:53
-
-
Save mythmon/9256581 to your computer and use it in GitHub Desktop.
This is what I used when I was at the OSL to shut down Firefox on remote systems with a NFS homedir.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
HN=`hostname -f` | |
echo hostname set to $HN | |
if test -e ~/.mozilla/firefox/lock_host ; then | |
LM=`cat ~/.mozilla/firefox/lock_host` | |
echo Firefox has taken a lock out on the following machine: | |
cat ~/.mozilla/firefox/lock_host | |
if [ "$LM" = "$HN" ] ; then | |
echo Running a repeat firefox | |
/usr/bin/firefox | |
exit | |
else | |
#kdialog –yesno "Firefox is locked on machine $LM \n Do you wish me to try to kill it?" | |
zenity --question --text="Firefox is locked on $LM.\nDo you wish me to try to kill it?" | |
if [ $? = 0 ]; then | |
echo "Trying to kill the remote firefox" | |
ssh -o "StrictHostKeyChecking no" $LM "killall -regexp firefox" 2> /tmp/.netfoxsshres | |
RES=`cat /tmp/.netfoxsshres` | |
rm -f /tmp/.netfoxsshres | |
zenity --info --text="Result was $RES" | |
fi | |
fi | |
else | |
echo No lock_host detected | |
echo Making lock_host | |
echo $HN > ~/.mozilla/firefox/lock_host | |
echo $(date) Starting on $HN >> ~/.mozilla/firefox/lock_host.log | |
fi | |
echo Running firefox | |
/usr/bin/firefox $@ | |
echo Removing lock_host | |
rm -f ~/.mozilla/firefox/lock_host | |
echo $(date) Exiting on $HN >> ~/.mozilla/firefox/lock_host.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment