LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


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

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


Hi,
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, 07:16 AM   #2
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
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, 07:38 AM   #3
nagabhushan
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 http://www.ghacks.net/2009/04/04/get...itd-directory/ you will get much explanations here.
 
  


Reply



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 02:00 AM
How to run a script to a remote linux machine from a windows machine squirrel001 Linux - Newbie 5 05-04-2009 06:06 PM
Run script on shutdown or reboot VeeDubbs Linux - Server 1 10-23-2008 01: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 03:29 AM
How to run a script at startup after a shutdown? kklein9 Linux - Software 3 01-27-2006 03:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

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