Creating a Keyboard Shortcut Question

Asked by MetungKP on 2011-05-16

sudo /etc/init.d/bluetooth restart

Since there are issues with Bluetooth and the only solution for it to work is by restarting it I created a Keyboard Shortcut for the above but it does not work. Is it because a password is required? Is there a way I could still create one?

Thanks!

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu ubuntu-meta Edit question
Assignee:
No assignee Edit question
Solved by:
AhmadAboBakr
Solved:
2011-05-17
Last query:
2011-05-17
Last reply:
2011-05-17

You can make a script then mess with visudo so the command doesn't require password when ran with sudo.

Best AhmadAboBakr (ahmadabobakr) said : #2

Try gksu instead of sudo

MetungKP (metungkp) said : #3

Thanks AhmadAboBakr, that solved my question.

MetungKP (metungkp) said : #4

By using gksu a window pops up asking for my password. It at least eliminated having to pull up Terminal.

I looked in to making a script but it looked too complicated for my level of experience.

Thanks!

Run:

gksudo gedit /usr/bin/myfix; chmod +x /usr/bin/myfix

add the below 2 lines:

#!/bin/bash
gksudo /etc/init.d/bluetooth restart

Save the new file and close gedit, you can now run it by pressing ALT+F2 and run 'myfix'. Change 'myfix' to something else if you so wish. That's all a script is. A little websearch would have shown you that