Creating a Keyboard Shortcut Question

Asked by MetungKP

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:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

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

Revision history for this message
Best AhmadAboBakr (ahmadabobakr) said :
#2

Try gksu instead of sudo

Revision history for this message
MetungKP (metungkp) said :
#3

Thanks AhmadAboBakr, that solved my question.

Revision history for this message
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!

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#5

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