The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Can SQL Server call be made from unix sh sspreethi Shell Programming and Scripting 0 01-29-2008 05:44 PM
here document to automate perl script that call script hogger84 Shell Programming and Scripting 3 10-22-2007 11:15 AM
Server rebooting frequently srikanthus2002 UNIX for Dummies Questions & Answers 5 07-03-2007 06:52 AM
Solaris 9 server hangs, when rebooting smohd UNIX for Advanced & Expert Users 3 09-03-2002 03:24 PM
Server name + IP address removed from host table after rebooting FIRE UNIX for Advanced & Expert Users 3 07-25-2002 04:42 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-21-2008
Selva_Kumar Selva_Kumar is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 12
Exclamation How to call the ksh script when rebooting the server

Hi all,

Can any one help me.......

I just want to run one shell script whenever i am rebooting the server. Is there any easy way to do that????


Thanks,
selva
  #2 (permalink)  
Old 08-21-2008
ynilesh's Avatar
ynilesh ynilesh is offline
Registered User
  
 

Join Date: Oct 2007
Location: Bangalore, India.
Posts: 222
Which OS, platform ?

- nilesh
  #3 (permalink)  
Old 08-21-2008
Selva_Kumar Selva_Kumar is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 12
Hi,

Thanks for you reply..

I am using AIX
  #4 (permalink)  
Old 08-21-2008
fpmurphy's Avatar
fpmurphy fpmurphy is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2003
Location: Florida
Posts: 1,926
Add it to the run level scripts under /etc/rc.d/. A run level script allow you to start and stop an application while changing the run level (which occurs when booting.) Put your run level script in the subdirectory of /etc/rc.d that is specific to the run level at which you wish your application to start. Scripts beginning with K are stop scripts, while scripts beginning with S are start scripts. Look at existing start scripts to see how to write your own start script correctly.
  #5 (permalink)  
Old 08-23-2008
Selva_Kumar Selva_Kumar is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 12
Smile How to call the ksh script when rebooting the server

Quote:
Originally Posted by fpmurphy View Post
Add it to the run level scripts under /etc/rc.d/. A run level script allow you to start and stop an application while changing the run level (which occurs when booting.) Put your run level script in the subdirectory of /etc/rc.d that is specific to the run level at which you wish your application to start. Scripts beginning with K are stop scripts, while scripts beginning with S are start scripts. Look at existing start scripts to see how to write your own start script correctly.
Thanks for your reply fpmurphy......

You mean that if you created the file like Start.ksh and store it in the /etc/rc.d it will call automatically when server starts up not inserver stop.

And if you create the file like KStop.ksh and store it in same path, it will call automatically when the server stop not in server start up...

Is my understanding is correct??????
  #6 (permalink)  
Old 08-23-2008
fpmurphy's Avatar
fpmurphy fpmurphy is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2003
Location: Florida
Posts: 1,926
Yes, that is the general idea.
  #7 (permalink)  
Old 08-23-2008
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
  
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,628
In AIX there is a file /etc/inittab, which is first utilized, then,for each runlevel, there is a directory in /etc/rc.d which contains start/stop-scripts. You could add such a start/stop-script as fpmurphy suggested (this is the BSD way to do it), you could add a line to /etc/inittab (the SysV way to do it) or you could start it as a subsystem vie the System Resource Controller, which is a AIX speciality. Each possibility would lead to the script being executed on different points in time and different circumstances - every startup, every time a certain runlevel is entered, etc., etc.. All this doesn't even take into account that your system might be part of a high-availability cluster, where even more possiblities would arise because it could be started every time a certain cluster event triggers: the machine becomes promoted to the "working" part of the cluster, the machine becomes the non-working part as another machine takes over, etc., etc..

Out of curiosity: why didn't you ask this question in my living room, the AIX forum?

I hope this helps.

bakunin
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:05 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0