version 1.1.2.5, 2007/01/10 01:59:28
|
version 1.1.2.6, 2007/01/10 02:47:20
|
|
|
#include "Path.h" | #include "Path.h" |
#include "Globals.h" | #include "Globals.h" |
#include "Socket.h" | #include "Socket.h" |
|
#include "Strlcpy.h" |
#include "Log.h" | #include "Log.h" |
| |
/* | /* |
|
|
**============================================================================== | **============================================================================== |
*/ | */ |
| |
void ExecShutdown() |
void ExecShutdown(int argc, char** argv) |
{ | { |
char* tmpArgv[3]; | char* tmpArgv[3]; |
|
char cimshutdownPath[EXECUTOR_BUFFER_SIZE]; |
|
char shutdownTimeout[EXECUTOR_BUFFER_SIZE]; |
| |
/* Get absolute cimshutdown program name. */ |
/* Get shutdownTimeout configuration parameter. */ |
| |
char cimshutdownPath[EXECUTOR_BUFFER_SIZE]; |
if (GetConfigParam(argc, argv, "shutdownTimeout", shutdownTimeout) != 0) |
|
Strlcpy(shutdownTimeout, "5", sizeof(shutdownTimeout)); |
|
|
|
/* Get absolute cimshutdown program name. */ |
| |
if (GetInternalPegasusProgramPath(CIMSHUTDOWN, cimshutdownPath) != 0) | if (GetInternalPegasusProgramPath(CIMSHUTDOWN, cimshutdownPath) != 0) |
Fatal(FL, "Failed to locate Pegasus program: %s", CIMSHUTDOWN); | Fatal(FL, "Failed to locate Pegasus program: %s", CIMSHUTDOWN); |
|
|
/* Create argument list. */ | /* Create argument list. */ |
| |
tmpArgv[0] = CIMSHUTDOWN; | tmpArgv[0] = CIMSHUTDOWN; |
tmpArgv[1] = EXECUTOR_FINGERPRINT; |
tmpArgv[1] = shutdownTimeout; |
tmpArgv[2] = 0; | tmpArgv[2] = 0; |
| |
/* Exec CIMSHUTDOWN program. */ | /* Exec CIMSHUTDOWN program. */ |
|
|
char username[EXECUTOR_BUFFER_SIZE]; | char username[EXECUTOR_BUFFER_SIZE]; |
int childPid; | int childPid; |
int perror; | int perror; |
|
long shutdownTimeout; |
| |
/* Save as global so it can be used in error and log messages. */ | /* Save as global so it can be used in error and log messages. */ |
| |
globals.arg0 = argv[0]; | globals.arg0 = argv[0]; |
| |
/* Get absolute cimservermain program name. */ |
|
|
|
if (GetInternalPegasusProgramPath(CIMSERVERMAIN, cimservermainPath) != 0) |
|
Fatal(FL, "Failed to locate Pegasus program: %s", CIMSERVERMAIN); |
|
|
|
/* If shuting down, then run "cimshutdown" client. */ | /* If shuting down, then run "cimshutdown" client. */ |
| |
for (i = 0; i < argc; i++) | for (i = 0; i < argc; i++) |
{ | { |
if (strcmp(argv[i], "-s") == 0) | if (strcmp(argv[i], "-s") == 0) |
ExecShutdown(); |
ExecShutdown(argc, argv); |
} | } |
| |
|
/* Get absolute cimservermain program name. */ |
|
|
|
if (GetInternalPegasusProgramPath(CIMSERVERMAIN, cimservermainPath) != 0) |
|
Fatal(FL, "Failed to locate Pegasus program: %s", CIMSERVERMAIN); |
|
|
/* If CIMSERVERMAIN is already running, warn and exit now. */ | /* If CIMSERVERMAIN is already running, warn and exit now. */ |
| |
if (TestCimServerProcess() == 0) | if (TestCimServerProcess() == 0) |