1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the License). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/CDDL.txt 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/CDDL.txt. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets [] replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 * 26 * apache_update.c - Update method for highly available apache 27 */ 28 29 #pragma ident "@(#)apache_update.c 1.21 07/06/06 SMI" 30 31 #include <stdio.h> 32 #include <stdlib.h> 33 #include <signal.h> 34 #include <rgm/libdsdev.h> 35 36 /* 37 * Some of the resource properties might have been updated. All such 38 * updatable properties are related to the fault monitor. Hence, just 39 * restarting the monitor should be enough. 40 */ 41 42 int 43 main(int argc, char *argv[]) 44 { 45 scds_handle_t scds_handle; 46 scha_err_t result; 47 48 /* Process the arguments passed by RGM and initialize syslog */ 49 if (scds_initialize(&scds_handle, argc, argv) != SCHA_ERR_NOERR) 50 return (1); 51 52 /* 53 * check if the Fault monitor is already running and if so stop and 54 * restart it. The second parameter to scds_pmf_restart_fm() uniquely 55 * identifies the instance of the fault monitor that needs to be 56 * restarted. 57 */ 58 59 result = scds_pmf_restart_fm(scds_handle, 0); 60 if (result != SCHA_ERR_NOERR) { 61 /* 62 * SCMSGS 63 * @explanation 64 * The resource property that was updated needed the fault 65 * monitor to be restarted inorder for the change to take 66 * effect, but the attempt to restart the fault monitor 67 * failed. 68 * @user_action 69 * Look at the prior syslog messages for specific problems. 70 * Correct the errors if possible. 71 * 72 * Look for the process <dataservice>_probe operating on the 73 * desired resource (indicated by the argument to "-R" 74 * option). This can be found from the command: ps -ef | egrep 75 * <dataservice>_probe | grep "\-R <resourcename>" Send a kill 76 * signal to this process. 77 * 78 * If the process does not get killed and restarted by the 79 * process monitor facility, reboot the node. 80 */ 81 scds_syslog(LOG_ERR, 82 "Failed to restart fault monitor."); 83 /* Free up all the memory allocated by scds_initialize */ 84 scds_close(&scds_handle); 85 return (1); 86 } 87 88 /* 89 * SCMSGS 90 * @explanation 91 * Data service method completed successfully. 92 * @user_action 93 * No action required. 94 */ 95 scds_syslog(LOG_INFO, 96 "Completed successfully."); 97 98 /* Free up all the memory allocated by scds_initialize */ 99 scds_close(&scds_handle); 100 101 return (0); 102 } 103