Run shell command

Asked by gabriel smith

Is there anyway to set up a Cuttlefish action to run a specific command or shell script?

Question information

Language:
English Edit question
Status:
Answered
For:
Cuttlefish Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
gabriel smith (gabriel-smith01) said :
#1

More specifically, allow 'sudo' commands to be issued. For example, the Action that I would like to setup would be: When power is unplugged, turn off Apache Server and MySQL server.

To do that would need terminal commands run as root.

Revision history for this message
Alex (noneed4anick) said :
#2

Just use the start application (advanced mode) reaction. You can then choose any executable script.

Revision history for this message
Alex (noneed4anick) said :
#3

@sudo stuff:

No, currently there is no such functionality. I hope it will come somewhat in the future. For now you might just use gksudo in your shellscript to create a visual input for the password.

Revision history for this message
gabriel smith (gabriel-smith01) said :
#4

I've tried that, but need a way to have the scripts run as root. I just if
there is a better way than updating the scripts to run with altered
permission levels

On Sun, Sep 23, 2012 at 6:31 PM, Alex
<email address hidden>wrote:

> Your question #209411 on Cuttlefish changed:
> https://answers.launchpad.net/cuttlefish/+question/209411
>
> Status: Open => Answered
>
> Alex proposed the following answer:
> Just use the start application (advanced mode) reaction. You can then
> choose any executable script.
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
>
> https://answers.launchpad.net/cuttlefish/+question/209411/+confirm?answer_id=1
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/cuttlefish/+question/209411
>
> You received this question notification because you asked the question.
>

Revision history for this message
eoin burke (eoin-burke) said :
#5

If you don't mind security you can use the wait command followed by xdotool to type your password and press enter automatically afterwards into the visual input for the password. It's what i do for gnome Keyring.

Revision history for this message
Laszlo Boros (semmu) said :
#6

You could also edit the sudoers file via visudo to allow the script to change user to root without password prompt :)

Can you help with this problem?

Provide an answer of your own, or ask gabriel smith for more information if necessary.

To post a message you must log in.