Sponsored Content
Top Forums Shell Programming and Scripting Shell script to Shutdown Computers on Cluster Post 302378686 by marcozd on Tuesday 8th of December 2009 01:07:14 PM
Old 12-08-2009
Question Shell script to Shutdown Computers on Cluster

Hello all.

I have built a cluster of 9 Macs for computational chemistry and I need a shell script that I can use from one computer to all the rest to shutdown.

I have modified all of the Macs so that there is pass-wordless ssh. As well, I have modified each "visudo" file on each machine by adding the line

Quote:
%users localhost=/sbin/shutdown -h now
The computer names are as follows: G5-1, G5-2, G5-3, etc up to G5-9. There are also two named G4-1 and G4-2.

If I type in a terminal

Quote:
$ ssh -f G5-2 "sudo shutdown -h now"
then G5-2 will shutdown.

What I was wondering was is there a way to write a script that I can execute from the main machine (which is G5-1) that will send this line to all of the machines and then wait 2 minutes and shut itself down?

That is, the script would send the shutdown command to G5-2, G5-3, G5-4, G5-5, G5-6, G5-7, G5-8, G5-9, G4-1 and G4-2. Then wait 1 minute and then shut itself down.

Please help.

Thanks.
 

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to invoke db startup/shutdown

Hi all, I have a shell script which does db shutdown ..the script snippet which does this is as follows: function call_sql_plus { ${SQLPLUS:-sqlplus} -s /nolog <<EOF EXIT; EOF if then echo "Error occurred while calling sqlplus " ... (3 Replies)
Discussion started by: KrishnaSaran
3 Replies

2. Shell Programming and Scripting

how to check all the applications are in cluster using shell script

Hi I have an application running in four different node.The server is tomcat.Each node in each tomcat server.How do i check whether all the nodes are in cluster using shell script. any command to check this would be of great use.:) (2 Replies)
Discussion started by: ahamed
2 Replies

3. Solaris

Shutdown the package in SUN cluster

Hi, I have a SUN cluster system. I want to know what script do when the SUN cluster shutdown the package as I may need to modify it ?? Where can I find out this information in the system?? In which directory and log file ??? Any suggestion ??? (5 Replies)
Discussion started by: chuikingman
5 Replies

4. UNIX for Dummies Questions & Answers

Script to force Oracle database shutdown when shutdown immediate does not work

I have Oracle 9i R2 on AIX 5.2. My Database is running in shared server mode (MTS). Sometimes when I shutdown the database it shutsdown cleanly in 4-5 mints and sometimes it takes good 15-20 minutes and then I get some ora-600 errors and only way to shutdown is by opening another session and... (7 Replies)
Discussion started by: aixhp
7 Replies

5. Shell Programming and Scripting

Need help on shell script to monitor each user cpu use on a cluster over time

Hi, I am relatively new to the cluster administration and shell scripting. I need help on a shell script which can help me determine how many cpu's over time, any particular ( or all registered users on a cluster ) are using. To generate data say over a period of week and list of users and their... (6 Replies)
Discussion started by: anuj06
6 Replies

6. Shell Programming and Scripting

Help required for Oracle database shutdown script conversion from shell to perl

Please tell me how to convert below program from shell script to perl. Same commands need to use in shutdown, just need program help for startup. export ORACLE_BASE=/home/oracle1 lsnrctl start lndb1 sqlplus '/ as sysdba' startup; (2 Replies)
Discussion started by: learnbash
2 Replies

7. Solaris

Shutdown Oracle DB on SunOS Cluster

Hi, I've this Oracle database version: Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production Oracle is install in a SunOS DBSERVER1 5.11 11.2 sun4v sparc sun4v cluster (Not RAC environment) DBSERVER1 is node active and DBSERVER2 is node inactive ... (4 Replies)
Discussion started by: db_senior
4 Replies
shutdown(1M)						  System Administration Commands					      shutdown(1M)

NAME
shutdown - shut down system, change system state SYNOPSIS
/usr/sbin/shutdown [-y] [-g grace-period] [-i init-state] [message] DESCRIPTION
shutdown is executed by the super user to change the state of the machine. In most cases, it is used to change from the multi-user state (state 2) to another state. By default, shutdown brings the system to a state where only the console has access to the operating system. This state is called single- user. Before starting to shut down daemons and killing processes, shutdown sends a warning message and, by default, a final message asking for confirmation. message is a string that is sent out following the standard warning message "The system will be shut down in ..." If the string contains more than one word, it should be contained within single (') or double (") quotation marks. The warning message and the user provided message are output when there are 7200, 3600, 1800, 1200, 600, 300, 120, 60, and 30 seconds remaining before shutdown begins. See EXAMPLES. System state definitions are: state 0 Stop the operating system. state 1 State 1 is referred to as the administrative state. In state 1 file systems required for multi-user operations are mounted, and logins requiring access to multi-user file systems can be used. When the system comes up from firmware mode into state 1, only the console is active and other multi-user (state 2) services are unavailable. Note that not all user processes are stopped when transitioning from multi-user state to state 1. state s, S State s (or S) is referred to as the single-user state. All user processes are stopped on transitions to this state. In the single-user state, file systems required for multi-user logins are unmounted and the system can only be accessed through the console. Logins requiring access to multi-user file systems cannot be used. state 5 Shut the machine down so that it is safe to remove the power. Have the machine remove power, if possible. The rc0 procedure is called to perform this task. state 6 Stop the operating system and reboot to the state defined by the initdefault entry in /etc/inittab. The rc6 procedure is called to perform this task. OPTIONS
-y Pre-answer the confirmation question so the command can be run without user intervention. -g grace-period Allow the super user to change the number of seconds from the 60-second default. -i init-state If there are warnings, init-state specifies the state init is to be in. By default, system state `s' is used. EXAMPLES
Example 1 Using shutdown In the following example, shutdown is being executed on host foo and is scheduled in 120 seconds. The warning message is output 2 minutes, 1 minute, and 30 seconds before the final confirmation message. example# shutdown -i S -g 120 "===== disk replacement =====" Shutdown started. Tue Jun 7 14:51:40 PDT 1994 Broadcast Message from root (pts/1) on foo Tue Jun 7 14:51:41... The system will be shut down in 2 minutes ===== disk replacement ===== Broadcast Message from root (pts/1) on foo Tue Jun 7 14:52:41... The system will be shut down in 1 minutes ===== disk replacement ===== Broadcast Message from root (pts/1) on foo Tue Jun 7 14:53:41... The system will be shut down in 30 seconds ===== disk replacement ===== Do you want to continue? (y or n): FILES
/etc/inittab controls process dispatching by init ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
boot(1M), halt(1M), init(1M), killall(1M), reboot(1M), ufsdump(1M), init.d(4), inittab(4), nologin(4), attributes(5) NOTES
When a system transitions down to the S or s state, the /etc/nologin file (see nologin(4)) is created. Upon subsequent transition to state 2 (multi-user state), this file is removed by a script in the /etc/rc2.d directory. SunOS 5.11 9 May 2001 shutdown(1M)
All times are GMT -4. The time now is 03:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy