You are not logged in.

#1 2009-01-22 20:03:44

ninjaprawn
Member
From: Manchester, UK
Registered: 2008-01-26
Posts: 485

[SOLVED]shutdown/reboot command for openbox menu

hi

ive just setup slim on my machine to log into openbox on boot. before i used slim, i used to ctrl+alt+backspace to kill X, then ctrl+alt+delete to reboot.

now, slim respawns, i am wondering if i can put a command or script into the openbox menu to reboot/shutdown? i am currently having to open a terminal, login as root, then type a command!

thanks

Last edited by ninjaprawn (2009-01-22 22:16:42)


2007 - Started using Arch Linux as my only/main OS
- Samsung Series 3, Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz - 8Gb DDR3 ram - 700Gb HDD
On board intel Graphics & Sound

Offline

#2 2009-01-22 20:16:58

joephantom
Member
From: Latinoamérica
Registered: 2008-01-09
Posts: 94
Website

Re: [SOLVED]shutdown/reboot command for openbox menu

you can use sudo (with NOPASSWD), and make a openbox menu entry that executes sudo halt.


By striving to do the impossible, man has always achieved what is possible. Those who have cautiously done no more than they believed possible have never taken a single step forward - Mikhail Bakunin

Offline

#3 2009-01-22 20:41:46

Morra
Member
Registered: 2008-05-16
Posts: 39

Re: [SOLVED]shutdown/reboot command for openbox menu

menu.xml

<item label="Exit">
    <action name="Exit"/>
</item>

<item label="Reboot">
    <action name="Execute">
        <prompt>
            Are you sure you want to reboot?
        </prompt>
        <execute>
            sudo shutdown -r now
        </execute>
    </action>
</item>

<item label="Shutdown">
    <action name="Execute">
        <prompt>
            Are you sure you want to shutdown?
        </prompt>
        <execute>
            sudo shutdown -h now
        </execute>
    </action>
</item>

Offline

#4 2009-01-22 21:20:35

ninjaprawn
Member
From: Manchester, UK
Registered: 2008-01-26
Posts: 485

Re: [SOLVED]shutdown/reboot command for openbox menu

thanks!


2007 - Started using Arch Linux as my only/main OS
- Samsung Series 3, Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz - 8Gb DDR3 ram - 700Gb HDD
On board intel Graphics & Sound

Offline

#5 2009-01-22 21:26:28

ninjaprawn
Member
From: Manchester, UK
Registered: 2008-01-26
Posts: 485

Re: [SOLVED]shutdown/reboot command for openbox menu

sorry, but does setting up sudo with no password mean that any time sudo is used, no password is ever required, and that root priveleges are obtained??


2007 - Started using Arch Linux as my only/main OS
- Samsung Series 3, Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz - 8Gb DDR3 ram - 700Gb HDD
On board intel Graphics & Sound

Offline

#6 2009-01-22 21:30:09

kevin89
Arch Linux f@h Team Member
From: Netherlands
Registered: 2007-03-14
Posts: 218

Re: [SOLVED]shutdown/reboot command for openbox menu

ninjaprawn: You're right, I suggest putting the following into you're /etc/sudoers, so that only shutdown/reboot needs no password:

%users localhost=/sbin/shutdown -h now
%users localhost=/sbin/shutdown -r now

Offline

#7 2009-01-22 21:41:59

ninjaprawn
Member
From: Manchester, UK
Registered: 2008-01-26
Posts: 485

Re: [SOLVED]shutdown/reboot command for openbox menu

thanks, i was just trying that! can i replace "%users" with my user name?

also, once all is installed and set up, i go to my menu, click reboot, get the yes/no question, then nuthing happens!

menu.xml

  <separator />
  <item label="Run...">
    <action name="Execute">
      <command>bashrun</command>
    </action>
  </item>

<item label="Exit">
    <action name="Exit"/>
</item>

<item label="Reboot">
    <action name="Execute">
        <prompt>
            Are you sure you want to reboot?
        </prompt>
        <execute>
            sudo shutdown -r now
        </execute>
    </action>
</item>

<item label="Shutdown">
    <action name="Execute">
        <prompt>
            Are you sure you want to shutdown?
        </prompt>
        <execute>
            sudo shutdown -h now
        </execute>
    </action>
</item>

  <item label="Log Out">
    <action name="SessionLogout">
      <prompt>yes</prompt>
    </action>
  </item>
</menu>

</openbox_menu>

2007 - Started using Arch Linux as my only/main OS
- Samsung Series 3, Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz - 8Gb DDR3 ram - 700Gb HDD
On board intel Graphics & Sound

Offline

#8 2009-01-22 21:47:32

jaloz
Member
Registered: 2008-11-18
Posts: 25

Re: [SOLVED]shutdown/reboot command for openbox menu

Here's another alternative.

From the slim documentation:

3. Special user names: reboot

You may shutdown, reboot, suspend, exit or even launch a terminal from the SLiM login screen. To do so, enter the appropriate value in the username field, and the root password in the password field:

    * To launch a terminal, enter console as the username (defaults to xterm which must be installed separately... edit /etc/slim.conf to change terminal preference)
    * For shutdown, enter halt as the username
    * For reboot, enter reboot as the username
    * For suspend, enter suspend as the username
    * To exit to the shell, enter exit as the username

Offline

#9 2009-01-22 21:47:58

SkonesMickLoud
Arch Linux f@h Team Member
From: The D of C
Registered: 2008-09-20
Posts: 178

Re: [SOLVED]shutdown/reboot command for openbox menu

ninjaprawn wrote:

thanks, i was just trying that! can i replace "%users" with my user name?

%users is the group, of which your username is a part of.

Offline

#10 2009-01-22 21:57:36

ninjaprawn
Member
From: Manchester, UK
Registered: 2008-01-26
Posts: 485

Re: [SOLVED]shutdown/reboot command for openbox menu

@jaloz
thanks, but if you read what you wrote, that is to be typed in at the login prompt, so of no use.

@SkonesMickLoud

 %users  localhost=/sbin/shutdown -h now NOPASSWD
 %users  localhost=/sbin/shutdown -r now NOPASSWD

with this, nothing happens, so i tried the command in a terminal, and it asks for a password!


2007 - Started using Arch Linux as my only/main OS
- Samsung Series 3, Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz - 8Gb DDR3 ram - 700Gb HDD
On board intel Graphics & Sound

Offline

#11 2009-01-22 22:16:10

ninjaprawn
Member
From: Manchester, UK
Registered: 2008-01-26
Posts: 485

Re: [SOLVED]shutdown/reboot command for openbox menu

solved!!!

%users  ArchLinux = NOPASSWD: /sbin/shutdown -h now, /sbin/shutdown -r now

thanks for the advice, i hadnt changed localhost!


2007 - Started using Arch Linux as my only/main OS
- Samsung Series 3, Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz - 8Gb DDR3 ram - 700Gb HDD
On board intel Graphics & Sound

Offline

Board footer

Powered by FluxBB