VectorLinux

Please login or register.

Login with username, password and session length
Advanced search  

News:

Visit our home page for VL info. For support and documentation, visit the Vector Linux Knowledge Center or search the Knowledge Center and this Forum using the search box above.

Author Topic: shutdown script  (Read 6676 times)

acous

  • Member
  • *
  • Posts: 78
shutdown script
« on: May 18, 2007, 01:00:47 am »

I am trying to put a button on the icewm panel that closes vector.

so I think there are 2 ways:

I write a script that makes 
su
password
shutdown

but there is a shutdown command from the "startmenu" is there a way to execute this from a terminal? then i dont need this script.


I know how to make buttons on the panel.
Logged

Joe1962

  • Administrator
  • Vectorian
  • *****
  • Posts: 2499
    • Joe1962's Website
Re: shutdown script
« Reply #1 on: May 18, 2007, 05:49:49 am »

Which version of VL? On XFCE or KDE, there is already a panel applet you can add for shutdown.
Logged
O'Neill (RE the Asgard): "Usually they ask nicely before they ignore us and do what they damn well please."
http://joe1962.bigbox.info
Running: VL 7 Std 64 + self-cooked XFCE-4.10

acous

  • Member
  • *
  • Posts: 78
Re: shutdown script
« Reply #2 on: May 18, 2007, 05:53:48 am »

linux 5.8 standard,

i am using IceWM
Logged

Joe1962

  • Administrator
  • Vectorian
  • *****
  • Posts: 2499
    • Joe1962's Website
Re: shutdown script
« Reply #3 on: May 18, 2007, 06:15:37 am »

Ah, sorry, I don't think Icewm has that, then again, I might be wrong because I've never used it much.
Logged
O'Neill (RE the Asgard): "Usually they ask nicely before they ignore us and do what they damn well please."
http://joe1962.bigbox.info
Running: VL 7 Std 64 + self-cooked XFCE-4.10

acous

  • Member
  • *
  • Posts: 78
Re: shutdown script
« Reply #4 on: May 18, 2007, 06:21:22 am »

but u can connect a panel button to a command, so if I make a script that shuts the computer down it should go.

is this possible?
one command to login as root   su?
then shutdown
  ???
Logged

M0E-lnx

  • Administrator
  • Vectorian
  • *****
  • Posts: 3279
Re: shutdown script
« Reply #5 on: May 18, 2007, 07:11:15 am »

I'm not sure how this would work since you need to be root to shutdown... other a very unsafe way (allowing all users to execute shutdown (ugly hack) ).

I'm not even sure a script could parse the password to su...
and even if it did, it would be a dirty shutdown. ( can't be good for your filesystem )

acous

  • Member
  • *
  • Posts: 78
Re: shutdown script
« Reply #6 on: May 18, 2007, 08:34:30 am »

yes, this seems like it wont be any good. Haven't found anything on the web either. Will not go further with this idea, thanks for help!
Logged

uelsk8s

  • Administrator
  • Vectorian
  • *****
  • Posts: 2504
Re: shutdown script
« Reply #7 on: May 18, 2007, 10:32:14 am »

the script would be easy as
Code: [Select]
#!/bin/bash
sudo /sbin/shutdown
Logged

M0E-lnx

  • Administrator
  • Vectorian
  • *****
  • Posts: 3279
Re: shutdown script
« Reply #8 on: May 18, 2007, 10:48:36 am »

but wont sudo need a password?

uelsk8s

  • Administrator
  • Vectorian
  • *****
  • Posts: 2504
Re: shutdown script
« Reply #9 on: May 18, 2007, 10:52:44 am »

it depends on how sudoers is setup on your system
for VL it should not need a password to shutdown or reboot
Logged

LLL

  • Global Moderator
  • Vectorite
  • *****
  • Posts: 263
  • The sun is shining...
Re: shutdown script
« Reply #10 on: May 18, 2007, 04:09:14 pm »

FYI:

The 'sudoers' Uel speaks of is a config-file responsible for controlling which users can 'sudo' for which commands. It's found at /etc/sudoers.
Logged
Lost & Lovin' Linux...living on:
VectorLinux 6.0 with XFCE on Thinkpad T43p (2.13 GHz | 2GB | 60GB)

acous

  • Member
  • *
  • Posts: 78
Re: shutdown script
« Reply #11 on: May 19, 2007, 01:23:11 am »

thanks, got it working!  :)
Logged

soren

  • Member
  • *
  • Posts: 12
Re: shutdown script
« Reply #12 on: May 22, 2007, 12:56:03 am »

... it would be a dirty shutdown. ( can't be good for your filesystem )

I know this is probably off-topic, but I got curious about this.

Could you clarify why 'shutdown' is dirty and bad for the filesystem? The program seems to do nothing but send SIGTERM to all processes, (then SIGKILL, which isn't really necessary) and changing to runlevel X? (I can't remember which runlevel is for halting the system...)

I would think that this is pretty much what happens anyway, if you select the shutdown item in the menu?

I usually just punch in 'shutdown -h now' in the terminal, rather than reaching for the mouse... If I am risking a filesystem error every time, I would sure like to know it!!!
Logged

bigpaws

  • Vectorian
  • ****
  • Posts: 1872
Re: shutdown script
« Reply #13 on: May 22, 2007, 01:20:59 am »

Quote
I would think that this is pretty much what happens anyway, if you select the shutdown item in the menu?

It is the same thing that happens.

Quote
I usually just punch in 'shutdown -h now' in the terminal, rather than reaching for the mouse... If I am risking a filesystem error every time, I would sure like to know it!!!

That is a fine, the only "dirty" shutdown is when SIGTEM has no be able to complete or having to
hard reboot. Other then that the shutdown procedure is the same.

HTH

Bigpaws
Logged