Exemplo n.º 1
0
int main (int argc, char *argv[]) {
	const char *options = "srl:u:v:k:a:c:hH";
	int opt;
	int service_load = 0;
	unsigned int nodeid;
	int service_unload = 0;
	char *service = NULL;
	unsigned int version = 0;

	if (argc == 1) {
		usage_do ();
	}
	while ( (opt = getopt(argc, argv, options)) != -1 ) {
		switch (opt) {
		case 's':
			ringstatusget_do ();
			break;
		case 'r':
			ringreenable_do ();
			break;
		case 'l':
			service_load = 1;
			service = xstrdup (optarg);
			break;
		case 'u':
			service_unload = 1;
			service = xstrdup (optarg);
			break;
		case 'k':
			nodeid = atoi (optarg);
			killnode_do(nodeid);
			break;
		case 'H':
			shutdown_do();
			break;
		case 'a':
			showaddrs_do( atoi(optarg) );
			break;
		case 'c':
			crypto_do( atoi(optarg) );
			break;
		case 'v':
			version = atoi (optarg);
			break;
		case 'h':
			usage_do();
			break;
		}
	}

	if (service_load) {
		service_load_do (service, version);
	} else
	if (service_unload) {
		service_unload_do (service, version);
	}

	return (0);
}
Exemplo n.º 2
0
int main (int argc, char *argv[]) {
	const char *options = "i:srRk:a:hH";
	int opt;
	unsigned int nodeid;
	char interface_name[128] = "";
	int rc=0;

	if (argc == 1) {
		usage_do ();
	}
	while ( (opt = getopt(argc, argv, options)) != -1 ) {
		switch (opt) {
		case 'i':
			strncpy(interface_name, optarg, sizeof(interface_name));
			break;
		case 's':
			printf("xxx 47000: tools/corosync-cfgtool.c main case \'s\' interface name (%s)", interface_name);
			rc = ringstatusget_do (interface_name);
			printf("xxx 47001: tools/corosync-cfgtool.c main case \'s\' interface name (%s)", interface_name);
			break;
		case 'R':
			rc = reload_config_do ();
			break;
		case 'r':
			ringreenable_do ();
			break;
		case 'k':
			nodeid = atoi (optarg);
			killnode_do(nodeid);
			break;
		case 'H':
			shutdown_do();
			break;
		case 'a':
			showaddrs_do( atoi(optarg) );
			break;
		case 'h':
			usage_do();
			break;
		}
	}

	return (rc);
}
Exemplo n.º 3
0
int main (int argc, char *argv[]) {
	const char *options = "i:sbrRk:a:hH";
	int opt;
	unsigned int nodeid = 0;
	char interface_name[128] = "";
	int rc = 0;
	enum user_action action = ACTION_NOOP;
	int brief = 0;

	while ( (opt = getopt(argc, argv, options)) != -1 ) {
		switch (opt) {
		case 'i':
			strncpy(interface_name, optarg, sizeof(interface_name));
			interface_name[sizeof(interface_name) - 1] = '\0';
			break;
		case 's':
			action = ACTION_LINKSTATUS_GET;
			break;
		case 'b':
			brief = 1;
			break;
		case 'R':
			action = ACTION_RELOAD_CONFIG;
			break;
		case 'k':
			nodeid = atoi (optarg);
			action = ACTION_KILL_NODE;
			break;
		case 'H':
			action = ACTION_SHUTDOW;
			break;
		case 'a':
			nodeid = atoi (optarg);
			action = ACTION_SHOWADDR;
			break;
		case '?':
			return (EXIT_FAILURE);
			break;
		case 'h':
		default:
			break;
		}
	}
	switch(action) {
	case ACTION_LINKSTATUS_GET:
		rc = linkstatusget_do(interface_name, brief);
		break;
	case ACTION_RELOAD_CONFIG:
		rc = reload_config_do();
		break;
	case ACTION_KILL_NODE:
		killnode_do(nodeid);
		break;
	case ACTION_SHUTDOW:
		shutdown_do();
		break;
	case ACTION_SHOWADDR:
		showaddrs_do(nodeid);
		break;
	case ACTION_NOOP:
	default:
		usage_do();
		break;
	}

	return (rc);
}