VectorLinux
October 24, 2014, 03:06:48 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Visit our home page for VL info. To search the old message board go to http://vectorlinux.com/forum1. The first VL forum is temporarily offline until we can find a host for it. Thanks for your patience.
 
Now powered by KnowledgeDex.
   Home   Help Search Login Register  
Please support VectorLinux!
Pages: [1]
  Print  
Author Topic: shutdown script  (Read 6010 times)
acous
Member
*
Posts: 78


« on: May 18, 2007, 12: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



WWW
« Reply #1 on: May 18, 2007, 04: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


« Reply #2 on: May 18, 2007, 04:53:48 am »

linux 5.8 standard,

i am using IceWM
Logged
Joe1962
Administrator
Vectorian
*****
Posts: 2499



WWW
« Reply #3 on: May 18, 2007, 05: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


« Reply #4 on: May 18, 2007, 05: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
  Huh
Logged
M0E-lnx
Administrator
Vectorian
*****
Posts: 3185



« Reply #5 on: May 18, 2007, 06: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 )
Logged

acous
Member
*
Posts: 78


« Reply #6 on: May 18, 2007, 07: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



« Reply #7 on: May 18, 2007, 09:32:14 am »

the script would be easy as
Code:
#!/bin/bash
sudo /sbin/shutdown
Logged
M0E-lnx
Administrator
Vectorian
*****
Posts: 3185



« Reply #8 on: May 18, 2007, 09:48:36 am »

but wont sudo need a password?
Logged

uelsk8s
Administrator
Vectorian
*****
Posts: 2504



« Reply #9 on: May 18, 2007, 09: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...


« Reply #10 on: May 18, 2007, 03: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


« Reply #11 on: May 19, 2007, 12:23:11 am »

thanks, got it working!  Smiley
Logged
soren
Member
*
Posts: 12


« Reply #12 on: May 21, 2007, 11:56:03 pm »

... 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: 1856


« Reply #13 on: May 22, 2007, 12: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
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!