VectorLinux
April 23, 2014, 04:45:43 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: How to run a command before shutdown in Vector Linux Ligth 6? [Solved]  (Read 2484 times)
arthurg
Member
*
Posts: 6


« on: September 09, 2011, 12:24:16 pm »

is there a way to run a command before shutdown  the system?

I want to run the following command:
Quote
/opt/lampp/lampp stop

Thanks for the help.
« Last Edit: September 15, 2011, 01:43:34 pm by arthurg » Logged
nightflier
Administrator
Vectorian
*****
Posts: 3941



« Reply #1 on: September 09, 2011, 12:37:02 pm »

Assuming VL6 Light with default IceWM:

In a text editor, open the file "~/.icewm/shutdown-dialog.sh"
- find this line:
      <action>"sudo /sbin/shutdown -h now"</action>
and add a line above it like this:
      <action>"/opt/lampp/lampp stop"</action>

You should do the same to the reboot line:
      <action>"sudo /sbin/shutdown -r now"</action>


Logged
arthurg
Member
*
Posts: 6


« Reply #2 on: September 09, 2011, 01:38:03 pm »

Thanks for your answer, but I forget to write that Im not using Xwindow with IceWM, Im using Vector Linux in console mode as a server (because is better and smaller than ubuntu server, for me).

So, it is possible to execute the command "/opt/lampp/lampp stop" before shutdown without a window system?

Logged
pierce.jason
Packager
Vectorite
****
Posts: 250



« Reply #3 on: September 12, 2011, 01:53:34 pm »

How are you starting your lampp server? Manually or do you have a script in /etc/rc.d?

In VL7 I have a file /etc/init.d/sample/lampp. This seems to run /opt/lampp/lamppd. It has the normal Start Stop Status Restart and Reload like all our /etc/init.d scripts.

If you copy this file from /etc/init.d/sample into /etc/init.d/ I believe you should be all set. After that you can use VASM or VasmCC to add lampp to your runlevel. It will then startup automatically with your system and shutdown automatically with your system. If this init script is too outdated and won't work for you, you can copy the one from /opt/lampp/lampp into the same location.

If you don't want it to start automatically, but do want it to shutdown automatically... You could add a line near the top of /etc/rc.d/rc.K that runs '/etc/init.d/lampp stop'. Alternatively you could manually create a symlink in rc#.d (where # is your default runlevel). A symlink named such as K##lampp pointing to ../init.d/lampp is what you would want here (## here is a number that controls what order the symlink is ran, in relation to the other symlinks in that directory).
Logged

pierce.jason
Email: $(echo -e "moc\x2eliamg\x40nosaj.ecreip" | rev)
M0E-lnx
Administrator
Vectorian
*****
Posts: 3134



« Reply #4 on: September 13, 2011, 03:32:01 am »

you could just write a script that executes yhe commands and use that script to shit down
Code:
#!/bin/bash
/opt/lampp/lampp stop && halt
call this script instead of the shutdown command.
Logged

nightflier
Administrator
Vectorian
*****
Posts: 3941



« Reply #5 on: September 15, 2011, 08:05:42 am »

As pierce.jason suggests, I think the best way would be through a script in /etc/rc.d/init.d
If you want to really hack your system, edit /etc/rc.d/rc.K .. this will void your warranty, though. Wink
Logged
arthurg
Member
*
Posts: 6


« Reply #6 on: September 15, 2011, 01:43:16 pm »

Thanks guys, modifying the file /etc/rc.d/rc.K worked well
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!