How to call the ksh script when rebooting the server


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to call the ksh script when rebooting the server
# 1  
Old 08-21-2008
Error 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  
Old 08-21-2008
Which OS, platform ?

- nilesh
# 3  
Old 08-21-2008
Hi,

Thanks for you reply..

I am using AIX
# 4  
Old 08-21-2008
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  
Old 08-22-2008
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  
Old 08-23-2008
Bug How to call the ksh script when rebooting the server

Quote:
Originally Posted by fpmurphy
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??????
# 7  
Old 08-23-2008
Yes, that is the general idea.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to call a power shell script from ksh or sh?

Hi, I have some .json scripts and azure commands in powershell script and I need to execute this powershell script from unix console by writing a shell script. But these powershell script is under my local for ex. C:\ drive. Would it be possible to achieve this? And do we need to install... (1 Reply)
Discussion started by: Samah
1 Replies

2. Red Hat

Server rebooting unexpectedly

hi, I have been working on Solaris am very new to linux. My concern is as it goes....our server is getting rebooted automatically and I am not able to understand anything from the var log messages. Could anybody help me out in troubleshooting the issue. 2.6.18-128.el5 #1 x86_64 GNU/Linux is... (1 Reply)
Discussion started by: EmbedUX
1 Replies

3. Solaris

Server Rebooting frequently

Deall All, I have facing some problem. I have a Sun 4500 Server at the customer place. Now the server is not booting mean's once the server is coming up it is automatically rebooting. As this is the critical server for the customer that is use for production . Can this be solved by... (10 Replies)
Discussion started by: sudhansu
10 Replies

4. Web Development

Call shell script from HTML page - without web server

Hi, I have html page in my unix machine(server), which I will open with firefox or mozilla available in unix machine. Firefox or mozilla will be opened using x windows. Since I have access to unix machien(like other users) and this HTML page is for user having access to Unix machine, I see no... (7 Replies)
Discussion started by: vamanu9
7 Replies

5. Shell Programming and Scripting

How to call an sql script inside a while statement in KSH

Hi all, I'm trying to run an sql inside a loop which looks like this #!bin/ksh while IFS=, read var1 var2 do sqlplus -s ${USERNAME}/${PASSWORD}@${ORACLE_SID} << EOF insert into ${TABLE} ( appt_date ) values ( '${var1 }' ); ... (6 Replies)
Discussion started by: ryukishin_17
6 Replies

6. Shell Programming and Scripting

HELP. Oracle Call from ksh script

I have searched the forums and couldn't find my specific issue so I figure that I would post on it. I am trying to run a simple sql script that spools to a flat file from a unix script. I have tried to make the call outright from inside of the ksh script as such: sqlplus... (3 Replies)
Discussion started by: BkontheShell718
3 Replies

7. Solaris

problem in rebooting solaris server

Hi, While we rebooting solaris server ,the system going to Maintenance mode instead of login console. even we are not able to run fsck command . Thanks in advanced for help. log attached FYI Executing last command: boot Boot device: /pci@83,4000/FJSV,ulsa@2,1/disk@0,0 File and args:... (3 Replies)
Discussion started by: helplineinc
3 Replies

8. Shell Programming and Scripting

Not able to 'su' to other user when rebooting the server

Hi All, I have created one script with starting letter 'S' (Example: Start) and stored in the path "/etc/rc.d/". This script was called automatically when we reboot the server. In this script i am using 'su' command to switch other user but it is not working, it giving some error. su... (2 Replies)
Discussion started by: Selva_Kumar
2 Replies

9. UNIX for Dummies Questions & Answers

Server rebooting frequently

O/P of the uname -a Server Server 4.0 3.0 3516 Pentium IV(TM)-ISA/PCI Server is getting rebooted frequetly... I don't know what is the problem in server ... Any help why the server is getting rebooted frequetly. Can i check what is the problem like in log files (5 Replies)
Discussion started by: srikanthus2002
5 Replies

10. UNIX for Advanced & Expert Users

Solaris 9 server hangs, when rebooting

Hi, We have a SunFire V880, hooked up with 2 T3 arrays. When ever we issue a reboot command on the system, it hangs at the same place right where it says syncing file systems done. To bring it back we shutdown power and it comes clean. By the way init 6 command works fine. Has anyone come... (3 Replies)
Discussion started by: smohd
3 Replies
Login or Register to Ask a Question