Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-18-2013, 03:59 AM   #1
LQ Newbie
Registered: Mar 2013
Posts: 1

Rep: Reputation: Disabled
Unhappy Run the script at machine shutdown.

I am novice user of RHEL 6.3.
I want to execute a script which will stop some services on my machine when the system stops(I dont want them to go in defunct state). I have copied the script at "/etc/init.d/" and created the soft link for same in "/etc/rc0.d".
But when i shutdown the machine the exceptions comes is "ssh: connect to host localhost port 22: Network is unreachable." My script contains the ssh command . It seems like ssh already gets killed before executing the script. I have created the softlink with name as "S00Execute_at_shutdown".

Can anyone help me to solve it.
Old 03-18-2013, 08:16 AM   #2
Senior Member
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,630

Rep: Reputation: 495Reputation: 495Reputation: 495Reputation: 495Reputation: 495
if you are shutting down the system, then the network is one of the first things to be placed into a "stop" condition.

post the code you have and be a bit less vague then we can start to help. in short if you are turning off the computer, it should be doing nothing but placing services in stop and then the last thing it will do is stop the kernel as it removes power from the hardware.
Old 03-18-2013, 08:38 AM   #3
LQ Newbie
Registered: Mar 2012
Posts: 16

Rep: Reputation: 0
Hi trumtrak,

Generally scripts starting with "K" execute first than "S" scripts. Script for sshd is K prefixed. So you might facing that problem.
Visit this link you will get much explanations here.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
init script does not run at the shutdown time procfs Linux - Newbie 4 02-16-2010 03:00 AM
How to run a script to a remote linux machine from a windows machine squirrel001 Linux - Newbie 5 05-04-2009 07:06 PM
Run script on shutdown or reboot VeeDubbs Linux - Server 1 10-23-2008 02:34 PM
I want to run script on the server from client machine in windows in a perl script vpradeep Linux - Newbie 2 09-01-2008 04:29 AM
How to run a script at startup after a shutdown? kklein9 Linux - Software 3 01-27-2006 04:32 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:07 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration