Skip to content

Instantly share code, notes, and snippets.

@cmavr8
Created September 19, 2011 13:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmavr8/1226522 to your computer and use it in GitHub Desktop.
Save cmavr8/1226522 to your computer and use it in GitHub Desktop.
Simple watchdog script to make sure NetworkManager applet is always running. Nm-applet is restarted after it's exited due to bugs etc.
#!/bin/bash
#This script makes sure nm-applet is always running.
echo "Initiating script (`date`)" > /tmp/nm-watchdog
while [ 1 == 1 ]
do
#echo "Checking..." >> /tmp/nm-watchdog
tmp=`ps -e |grep nm-applet`
if [[ "$tmp" == '' ]]
then
export DISPLAY=':0.0'
nm-applet &
echo "NM started!" >> /tmp/nm-watchdog
#else
#echo "NM is already running" >> /tmp/nm-watchdog
fi
sleep 5
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment