- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Writing a scritp to reboot a remote machine
Operating System - HP-UX
1767188
Members
6117
Online
108959
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-31-2006 12:25 AM
тАО03-31-2006 12:25 AM
Re: Writing a scritp to reboot a remote machine
Hi Ninad,
Actually, I am doing a test case which requires remote machine to be rebooted repeated.
I need to do this n number of times with n number of machines. Hence, I wrote a script. Now, I am able to reboot machines repeatedly.
I can stop this continuos reboot mannually, but want a method through which i can stop this process from remote machine.
I have written a script for this stop perpose also, which establishes a ssh connection and removes this Sreboot file from that directory, but is not working ssh connection is timed out everytime.
I am not sure whether sshd is started before the scripts in /etc/rc.config.d/ are ran.
Can you pl. help me in this case?
Thanks for your replay.
Prasad
Actually, I am doing a test case which requires remote machine to be rebooted repeated.
I need to do this n number of times with n number of machines. Hence, I wrote a script. Now, I am able to reboot machines repeatedly.
I can stop this continuos reboot mannually, but want a method through which i can stop this process from remote machine.
I have written a script for this stop perpose also, which establishes a ssh connection and removes this Sreboot file from that directory, but is not working ssh connection is timed out everytime.
I am not sure whether sshd is started before the scripts in /etc/rc.config.d/ are ran.
Can you pl. help me in this case?
Thanks for your replay.
Prasad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-31-2006 12:42 AM
тАО03-31-2006 12:42 AM
Re: Writing a scritp to reboot a remote machine
Hi Prasad,
you should be able to achive this by placing a file on your controlstation/server for each remote server you want to boot, like i.e. /var/bootflags/reboot.
Then in the script copied to each server check for the existance of this remote file and reboot only if it is there.
This way you can interrupt the instant-reboot by deleting/renaming the file on your local machine.
To be sure you have ssh available on the remote server you should place the remote script into /sbin/init.d and have it called via an appropriate link in /sbin/rc2.d after sshd started up.
regards,
Bernd
you should be able to achive this by placing a file on your controlstation/server for each remote server you want to boot, like i.e. /var/bootflags/reboot.
Then in the script copied to each server check for the existance of this remote file and reboot only if it is there.
This way you can interrupt the instant-reboot by deleting/renaming the file on your local machine.
To be sure you have ssh available on the remote server you should place the remote script into /sbin/init.d and have it called via an appropriate link in /sbin/rc2.d after sshd started up.
regards,
Bernd
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-31-2006 10:15 PM
тАО03-31-2006 10:15 PM
Solution
Prasad,
I think the way forward for you is as below
Assuming you want your remote servers to boot upto init level 3 and then reboot and continue this untill you want it to reboot.
On Local server
1. Write a script which will issue a reboot command to the remote server
2. You must have a file for each remote server in you local server. The file will have either CONTINUE or STOP word in it.
Whenever you want to start rebooting a particular remote server - open the corresponding file on your local server and write the word CONTINUE, run the script mentioned in step 1 to give the reboot command to that particular remote server.
Whenever you want the remote server to stop edit this file and write the word STOP
On remote server
1. Create a script in /sbin/init.d with name say srvreboot - Check other scripts in this location to understand the general format of the script - something like this:
case "$i" in
'start') commands to execute
;;
'stop') echo ""
;;
esac
commands to execute - Here call a script which will reside on the remote server. This script checks the contents of the file meant for this remote server in your local server through ssh and if contents are CONTINUE then issues command reboot; if contents are STOP then just echo "" .
2. In /sbin/rc3.d create a link to the above created file
cd /sbin/rc3.d
ln -s /sbin/init.d/srvreboot S99srvreboot
By mentioning S99 - will ensure that the remote server has booted and started all the services and your srvreboot script is executed almost as the remote server has booted to run level 3.
Thus by doing so you wont face the problem of ssh timeout. You can instruct the remote server when to start rebooting and each remote server will check the respective file on your local server to check if it is supposed to stop rebooting.
This is just the logic. I am sure you will be able to develop the scripts yourself. If still you face any problem. Or the above does not satisfy your requirement, let know.
Best of luck.
Ninad
I think the way forward for you is as below
Assuming you want your remote servers to boot upto init level 3 and then reboot and continue this untill you want it to reboot.
On Local server
1. Write a script which will issue a reboot command to the remote server
2. You must have a file for each remote server in you local server. The file will have either CONTINUE or STOP word in it.
Whenever you want to start rebooting a particular remote server - open the corresponding file on your local server and write the word CONTINUE, run the script mentioned in step 1 to give the reboot command to that particular remote server.
Whenever you want the remote server to stop edit this file and write the word STOP
On remote server
1. Create a script in /sbin/init.d with name say srvreboot - Check other scripts in this location to understand the general format of the script - something like this:
case "$i" in
'start') commands to execute
;;
'stop') echo ""
;;
esac
commands to execute - Here call a script which will reside on the remote server. This script checks the contents of the file meant for this remote server in your local server through ssh and if contents are CONTINUE then issues command reboot; if contents are STOP then just echo "" .
2. In /sbin/rc3.d create a link to the above created file
cd /sbin/rc3.d
ln -s /sbin/init.d/srvreboot S99srvreboot
By mentioning S99 - will ensure that the remote server has booted and started all the services and your srvreboot script is executed almost as the remote server has booted to run level 3.
Thus by doing so you wont face the problem of ssh timeout. You can instruct the remote server when to start rebooting and each remote server will check the respective file on your local server to check if it is supposed to stop rebooting.
This is just the logic. I am sure you will be able to develop the scripts yourself. If still you face any problem. Or the above does not satisfy your requirement, let know.
Best of luck.
Ninad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-04-2006 08:24 PM
тАО04-04-2006 08:24 PM
Re: Writing a scritp to reboot a remote machine
Thanks a lot to all
- « Previous
-
- 1
- 2
- Next »
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP