Because sudo and its gui equivalent gksudo both require a password to be entered if you haven't done so in the last 10 minutes this is going to be a little more complex but is none the less achievable.
Put the following into /etc/rc.local, this script is run at startup as root so there will be no need to use sudo, replace yourusername with...well you get the idea. To edit the file open a terminal an use
Code:
sudo gedit /etc/rc.local
Code:
#!/bin/bash
#checks for a file in user home directory and if exists restarts service
while [ 1 ]
do
sleep 120
if [ -f /home/yourusername/.restartbluetooth ]; then
echo "file found restarting service"
/etc/init.d/bluetooth restart && rm /home/yourusername/.restartbluetooth
else
echo "file not found looping"
fi
done
After entering this into the file ensure that the file is executable using
Code:
sudo chmod +x /etc/rc.local
Now create a launcher on your desktop using whatever icon/name you want with the following command
Code:
touch /home/yourusername/.restartbluetooth
This will create the file that the rc.local script looks for resulting in the service being restarted.
Bookmarks