File util_service.c
FileList > cubrid > src > executables > util_service.c
Go to the source code of this file
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <assert.h>
#include <sys/wait.h>
#include "porting.h"
#include "utility.h"
#include "error_code.h"
#include "error_manager.h"
#include "system_parameter.h"
#include "client_support.h"
#include "util_func.h"
#include "util_support.h"
#include "environment_variable.h"
#include "release_string.h"
#include "dynamic_array.h"
#include "heartbeat.h"
#include "process_util.h"
#include "pl_file.h"
#include <string>
Classes
Public Types
Public Static Attributes
Public Functions
Public Static Functions
| Type |
Name |
| bool |
are_all_services_running (unsigned int sleep_time, bool check_win_service)
|
| bool |
are_all_services_stopped (unsigned int sleep_time, bool check_win_service)
|
| bool |
check_all_services_status (unsigned int sleep_time, UTIL_ALL_SERVICES_STATUS expected_status, bool check_win_service)
|
| bool |
check_server (const char * type, const char * server_name)
|
| const char * |
command_string (int command_type)
|
| void |
finalize_properties (void)
|
| const char * |
get_property (int property_type)
|
| void |
get_server_names (const char * type, char ** name_buffer)
|
| int |
ha_argv_to_args (char * args, int size, const char ** argv, HB_PROC_TYPE type)
|
| bool |
ha_concat_db_and_host (char * db_host, int size, const char * db, const char * host)
|
| bool |
ha_is_registered (const char * args, const char * hostname)
|
| bool |
ha_make_log_path (char * path, int size, char * base, char * db, char * node)
|
| bool |
ha_make_mem_size (char * mem_size, int size, int value)
|
| bool |
ha_mkdir (const char * path, mode_t mode)
|
| void |
hide_cmd_line_args (char ** args)
|
| int |
is_broker_running (void)
|
| int |
is_gateway_running (void)
|
| UTIL_MANAGER_SERVER_STATUS_E |
is_manager_running (unsigned int sleep_time)
|
| UTIL_PL_SERVER_STATUS_E |
is_pl_running (const char * server_name)
|
| bool |
is_server_running (const char * type, const char * server_name, int pid)
|
| int |
load_properties (void)
|
| char * |
make_exec_abspath (char * buf, int buf_len, char * cmd)
|
| int |
parse_arg (UTIL_SERVICE_OPTION_MAP_T * option, const char * arg)
|
| void |
print_message (FILE * output, int message_id, ...)
|
| void |
print_result (const char * util_name, int status, int command_type)
|
| int |
proc_execute (const char * file, const char * args, bool wait_child, bool close_output, bool close_err, int * pid)
|
| int |
proc_execute_hide_cmd_args (const char * file, const char * args, bool wait_child, bool close_output, bool close_err, int * pid)
|
| int |
proc_execute_internal (const char * file, const char * args, bool wait_child, bool close_output, bool close_err, bool hide_cmd_args, int * pid)
|
| int |
process_admin (int argc, char ** argv)
|
| int |
process_broker (int command_type, int argc, const char ** argv, bool process_window_service)
|
| int |
process_gateway (int command_type, int argc, const char ** argv, bool process_window_service)
|
| int |
process_heartbeat (int command_type, int argc, const char ** argv)
|
| int |
process_heartbeat_deregister (int argc, const char ** argv)
|
| int |
process_heartbeat_reload (int argc, const char ** argv)
|
| int |
process_heartbeat_replication (HA_CONF * ha_conf, int argc, const char ** argv)
|
| int |
process_heartbeat_start (HA_CONF * ha_conf, int argc, const char ** argv)
|
| int |
process_heartbeat_status (int argc, const char ** argv)
|
| int |
process_heartbeat_stop (HA_CONF * ha_conf, int argc, const char ** argv)
|
| int |
process_heartbeat_util (HA_CONF * ha_conf, int command_type, int argc, const char ** argv)
|
| int |
process_manager (int command_type, bool process_window_service)
|
| int |
process_master (int command_type)
|
| int |
process_pl (int command_type, int argc, const char ** argv, bool show_usage, bool suppress_message, bool process_window_service, bool ha_mode)
|
| int |
process_pl_restart (const char * db_name, bool suppress_message, bool process_window_service)
|
| int |
process_pl_restart (const char * db_name, bool suppress_message)
|
| int |
process_pl_status (const char * db_name, bool suppress_message)
|
| int |
process_pl_status (const char * db_name)
|
| int |
process_server (int command_type, int argc, char ** argv, bool show_usage, bool check_ha_mode, bool process_window_service)
|
| int |
process_service (int command_type, bool process_window_service)
|
| int |
shutdown_reviving_server (const char * server_name)
|
| int |
us_hb_applylogdb_start (dynamic_array * out_ap, HA_CONF * ha_conf, const char * db_name, const char * node_name, const char * remote_host)
|
| int |
us_hb_applylogdb_stop (HA_CONF * ha_conf, const char * db_name, const char * node_name, const char * remote_host)
|
| int |
us_hb_copylogdb_start (dynamic_array * out_ap, HA_CONF * ha_conf, const char * db_name, const char * node_name, const char * remote_host)
|
| int |
us_hb_copylogdb_stop (HA_CONF * ha_conf, const char * db_name, const char * node_name, const char * remote_host)
|
| int |
us_hb_deactivate (const char * hostname, bool immediate_stop)
|
| int |
us_hb_process_applylogdb (int command_type, HA_CONF * ha_conf, const char * db_name, const char * node_name, const char * remote_host)
|
| int |
us_hb_process_copylogdb (int command_type, HA_CONF * ha_conf, const char * db_name, const char * node_name, const char * remote_host)
|
| int |
us_hb_process_server (int command_type, HA_CONF * ha_conf, const char * db_name)
|
| int |
us_hb_process_start (HA_CONF * ha_conf, const char * db_name, bool check_result)
|
| int |
us_hb_process_stop (HA_CONF * ha_conf, const char * db_name)
|
| int |
us_hb_server_start (HA_CONF * ha_conf, const char * db_name)
|
| int |
us_hb_server_stop (HA_CONF * ha_conf, const char * db_name)
|
| int |
us_hb_status_get_options (bool * verbose, char * remote_host_name, int remote_host_name_size, int argc, const char ** argv)
|
| int |
us_hb_stop_get_options (char * db_name, int db_name_size, char * host_name, int host_name_size, bool * immediate_stop, int argc, const char ** argv)
|
| int |
us_hb_util_get_options (char * db_name, int db_name_size, char * node_name, int node_name_size, char * remote_host_name, int remote_host_name_size, int argc, const char ** argv)
|
| int |
us_hb_utils_start (dynamic_array * pids, HA_CONF * ha_conf, const char * db_name, const char * node_name)
|
| int |
us_hb_utils_stop (HA_CONF * ha_conf, const char * db_name, const char * node_name)
|
| int |
util_get_command_option_mask (int command_type)
|
| int |
util_get_service_option_mask (int util_type)
|
| void |
util_service_usage (int util_type)
|
| void |
util_service_version (const char * argv0)
|
Macros
Public Types Documentation
enum UTIL_ALL_SERVICES_STATUS
enum UTIL_ALL_SERVICES_STATUS {
ALL_SERVICES_RUNNING,
ALL_SERVICES_STOPPED
};
enum UTIL_MANAGER_SERVER_STATUS_E
enum UTIL_MANAGER_SERVER_STATUS_E {
MANAGER_SERVER_RUNNING = 0,
MANAGER_SERVER_STOPPED,
MANAGER_SERVER_STATUS_ERROR
};
enum UTIL_PL_SERVER_STATUS_E
enum UTIL_PL_SERVER_STATUS_E {
PL_SERVER_RUNNING = 0,
PL_SERVER_STOPPED,
PL_SERVER_STATUS_ERROR,
PL_SERVER_STARTING
};
enum UTIL_SERVICE_COMMAND_E
enum UTIL_SERVICE_COMMAND_E {
START,
STOP,
RESTART,
STATUS,
DEREGISTER,
LIST,
RELOAD,
ON,
OFF,
ACCESS_CONTROL,
RESET,
INFO,
SC_COPYLOGDB,
SC_APPLYLOGDB,
GET_SHARID,
TEST,
REPLICATION
};
enum UTIL_SERVICE_INDEX_E
enum UTIL_SERVICE_INDEX_E {
SERVICE = 0,
SERVER = 1,
BROKER = 2,
MANAGER = 3,
HEARTBEAT = 4,
UTIL_HELP = 6,
UTIL_VERSION = 7,
ADMIN = 8,
PL_UTIL = 20,
GATEWAY = 21
};
enum UTIL_SERVICE_PROPERTY_E
enum UTIL_SERVICE_PROPERTY_E {
SERVICE_START_SERVER,
SERVICE_START_BROKER,
SERVICE_START_MANAGER,
SERVER_START_LIST,
SERVICE_START_HEARTBEAT,
SERVICE_START_GATEWAY
};
Public Static Attributes Documentation
variable Argv
variable ha_mode_in_common
variable us_Command_map
UTIL_SERVICE_OPTION_MAP_T us_Command_map[];
variable us_Property_map
UTIL_SERVICE_PROPERTY_T us_Property_map[];
variable us_Service_map
UTIL_SERVICE_OPTION_MAP_T us_Service_map[];
Public Functions Documentation
function main
int main (
int argc,
char * argv
)
Public Static Functions Documentation
function are_all_services_running
static bool are_all_services_running (
unsigned int sleep_time,
bool check_win_service
)
function are_all_services_stopped
static bool are_all_services_stopped (
unsigned int sleep_time,
bool check_win_service
)
function check_all_services_status
static bool check_all_services_status (
unsigned int sleep_time,
UTIL_ALL_SERVICES_STATUS expected_status,
bool check_win_service
)
function check_server
static bool check_server (
const char * type,
const char * server_name
)
function command_string
static const char * command_string (
int command_type
)
function finalize_properties
static void finalize_properties (
void
)
function get_property
static const char * get_property (
int property_type
)
function get_server_names
static void get_server_names (
const char * type,
char ** name_buffer
)
function ha_argv_to_args
static int ha_argv_to_args (
char * args,
int size,
const char ** argv,
HB_PROC_TYPE type
)
function ha_concat_db_and_host
static bool ha_concat_db_and_host (
char * db_host,
int size,
const char * db,
const char * host
)
function ha_is_registered
static bool ha_is_registered (
const char * args,
const char * hostname
)
function ha_make_log_path
static bool ha_make_log_path (
char * path,
int size,
char * base,
char * db,
char * node
)
function ha_make_mem_size
static bool ha_make_mem_size (
char * mem_size,
int size,
int value
)
function ha_mkdir
static bool ha_mkdir (
const char * path,
mode_t mode
)
function hide_cmd_line_args
static void hide_cmd_line_args (
char ** args
)
function is_broker_running
static int is_broker_running (
void
)
function is_gateway_running
static int is_gateway_running (
void
)
function is_manager_running
static UTIL_MANAGER_SERVER_STATUS_E is_manager_running (
unsigned int sleep_time
)
function is_pl_running
static UTIL_PL_SERVER_STATUS_E is_pl_running (
const char * server_name
)
function is_server_running
static bool is_server_running (
const char * type,
const char * server_name,
int pid
)
function load_properties
static int load_properties (
void
)
function make_exec_abspath
static char * make_exec_abspath (
char * buf,
int buf_len,
char * cmd
)
function parse_arg
static int parse_arg (
UTIL_SERVICE_OPTION_MAP_T * option,
const char * arg
)
function print_message
static void print_message (
FILE * output,
int message_id,
...
)
function print_result
static void print_result (
const char * util_name,
int status,
int command_type
)
function proc_execute
static int proc_execute (
const char * file,
const char * args,
bool wait_child,
bool close_output,
bool close_err,
int * pid
)
function proc_execute_hide_cmd_args
static int proc_execute_hide_cmd_args (
const char * file,
const char * args,
bool wait_child,
bool close_output,
bool close_err,
int * pid
)
function proc_execute_internal
static int proc_execute_internal (
const char * file,
const char * args,
bool wait_child,
bool close_output,
bool close_err,
bool hide_cmd_args,
int * pid
)
function process_admin
static int process_admin (
int argc,
char ** argv
)
function process_broker
static int process_broker (
int command_type,
int argc,
const char ** argv,
bool process_window_service
)
function process_gateway
static int process_gateway (
int command_type,
int argc,
const char ** argv,
bool process_window_service
)
function process_heartbeat
static int process_heartbeat (
int command_type,
int argc,
const char ** argv
)
function process_heartbeat_deregister
static int process_heartbeat_deregister (
int argc,
const char ** argv
)
function process_heartbeat_reload
static int process_heartbeat_reload (
int argc,
const char ** argv
)
function process_heartbeat_replication
static int process_heartbeat_replication (
HA_CONF * ha_conf,
int argc,
const char ** argv
)
function process_heartbeat_start
static int process_heartbeat_start (
HA_CONF * ha_conf,
int argc,
const char ** argv
)
function process_heartbeat_status
static int process_heartbeat_status (
int argc,
const char ** argv
)
function process_heartbeat_stop
static int process_heartbeat_stop (
HA_CONF * ha_conf,
int argc,
const char ** argv
)
function process_heartbeat_util
static int process_heartbeat_util (
HA_CONF * ha_conf,
int command_type,
int argc,
const char ** argv
)
function process_manager
static int process_manager (
int command_type,
bool process_window_service
)
function process_master
static int process_master (
int command_type
)
function process_pl
static int process_pl (
int command_type,
int argc,
const char ** argv,
bool show_usage,
bool suppress_message,
bool process_window_service,
bool ha_mode
)
function process_pl_restart
static int process_pl_restart (
const char * db_name,
bool suppress_message,
bool process_window_service
)
function process_pl_restart
static int process_pl_restart (
const char * db_name,
bool suppress_message
)
function process_pl_status
static int process_pl_status (
const char * db_name,
bool suppress_message
)
function process_pl_status
static int process_pl_status (
const char * db_name
)
function process_server
static int process_server (
int command_type,
int argc,
char ** argv,
bool show_usage,
bool check_ha_mode,
bool process_window_service
)
function process_service
static int process_service (
int command_type,
bool process_window_service
)
function shutdown_reviving_server
static int shutdown_reviving_server (
const char * server_name
)
function us_hb_applylogdb_start
static int us_hb_applylogdb_start (
dynamic_array * out_ap,
HA_CONF * ha_conf,
const char * db_name,
const char * node_name,
const char * remote_host
)
function us_hb_applylogdb_stop
static int us_hb_applylogdb_stop (
HA_CONF * ha_conf,
const char * db_name,
const char * node_name,
const char * remote_host
)
function us_hb_copylogdb_start
static int us_hb_copylogdb_start (
dynamic_array * out_ap,
HA_CONF * ha_conf,
const char * db_name,
const char * node_name,
const char * remote_host
)
function us_hb_copylogdb_stop
static int us_hb_copylogdb_stop (
HA_CONF * ha_conf,
const char * db_name,
const char * node_name,
const char * remote_host
)
function us_hb_deactivate
static int us_hb_deactivate (
const char * hostname,
bool immediate_stop
)
function us_hb_process_applylogdb
static int us_hb_process_applylogdb (
int command_type,
HA_CONF * ha_conf,
const char * db_name,
const char * node_name,
const char * remote_host
)
function us_hb_process_copylogdb
static int us_hb_process_copylogdb (
int command_type,
HA_CONF * ha_conf,
const char * db_name,
const char * node_name,
const char * remote_host
)
function us_hb_process_server
static int us_hb_process_server (
int command_type,
HA_CONF * ha_conf,
const char * db_name
)
function us_hb_process_start
static int us_hb_process_start (
HA_CONF * ha_conf,
const char * db_name,
bool check_result
)
function us_hb_process_stop
static int us_hb_process_stop (
HA_CONF * ha_conf,
const char * db_name
)
function us_hb_server_start
static int us_hb_server_start (
HA_CONF * ha_conf,
const char * db_name
)
function us_hb_server_stop
static int us_hb_server_stop (
HA_CONF * ha_conf,
const char * db_name
)
function us_hb_status_get_options
static int us_hb_status_get_options (
bool * verbose,
char * remote_host_name,
int remote_host_name_size,
int argc,
const char ** argv
)
function us_hb_stop_get_options
static int us_hb_stop_get_options (
char * db_name,
int db_name_size,
char * host_name,
int host_name_size,
bool * immediate_stop,
int argc,
const char ** argv
)
function us_hb_util_get_options
static int us_hb_util_get_options (
char * db_name,
int db_name_size,
char * node_name,
int node_name_size,
char * remote_host_name,
int remote_host_name_size,
int argc,
const char ** argv
)
function us_hb_utils_start
static int us_hb_utils_start (
dynamic_array * pids,
HA_CONF * ha_conf,
const char * db_name,
const char * node_name
)
function us_hb_utils_stop
static int us_hb_utils_stop (
HA_CONF * ha_conf,
const char * db_name,
const char * node_name
)
function util_get_command_option_mask
static int util_get_command_option_mask (
int command_type
)
function util_get_service_option_mask
static int util_get_service_option_mask (
int util_type
)
function util_service_usage
static void util_service_usage (
int util_type
)
function util_service_version
static void util_service_version (
const char * argv0
)
Macro Definition Documentation
define COMMAND_TYPE_ACL
#define COMMAND_TYPE_ACL `"acl"`
define COMMAND_TYPE_APPLYLOGDB
#define COMMAND_TYPE_APPLYLOGDB `"applylogdb"`
define COMMAND_TYPE_COPYLOGDB
#define COMMAND_TYPE_COPYLOGDB `"copylogdb"`
define COMMAND_TYPE_DEREG
#define COMMAND_TYPE_DEREG `"deregister"`
define COMMAND_TYPE_GETID
#define COMMAND_TYPE_GETID `"getid"`
define COMMAND_TYPE_INFO
#define COMMAND_TYPE_INFO `"info"`
define COMMAND_TYPE_LIST
#define COMMAND_TYPE_LIST `"list"`
define COMMAND_TYPE_OFF
#define COMMAND_TYPE_OFF `"off"`
define COMMAND_TYPE_ON
#define COMMAND_TYPE_ON `"on"`
define COMMAND_TYPE_RELOAD
#define COMMAND_TYPE_RELOAD `"reload"`
define COMMAND_TYPE_REPLICATION
#define COMMAND_TYPE_REPLICATION `"replication"`
define COMMAND_TYPE_REPLICATION_SHORT
#define COMMAND_TYPE_REPLICATION_SHORT `"repl"`
define COMMAND_TYPE_RESET
#define COMMAND_TYPE_RESET `"reset"`
define COMMAND_TYPE_RESTART
#define COMMAND_TYPE_RESTART `"restart"`
define COMMAND_TYPE_START
#define COMMAND_TYPE_START `"start"`
define COMMAND_TYPE_STATUS
#define COMMAND_TYPE_STATUS `"status"`
define COMMAND_TYPE_STOP
#define COMMAND_TYPE_STOP `"stop"`
define COMMAND_TYPE_TEST
#define COMMAND_TYPE_TEST `"test"`
define US_HB_DEREG_WAIT_TIME_IN_SEC
#define US_HB_DEREG_WAIT_TIME_IN_SEC `100`
define UTIL_TYPE_BROKER
#define UTIL_TYPE_BROKER `"broker"`
define UTIL_TYPE_GATEWAY
#define UTIL_TYPE_GATEWAY `"gateway"`
define UTIL_TYPE_HB_SHORT
#define UTIL_TYPE_HB_SHORT `"hb"`
define UTIL_TYPE_HEARTBEAT
#define UTIL_TYPE_HEARTBEAT `"heartbeat"`
define UTIL_TYPE_MANAGER
#define UTIL_TYPE_MANAGER `"manager"`
define UTIL_TYPE_PL
#define UTIL_TYPE_PL `"pl"`
define UTIL_TYPE_SERVER
#define UTIL_TYPE_SERVER `"server"`
define UTIL_TYPE_SERVICE
#define UTIL_TYPE_SERVICE `"service"`
define WAIT_TIMEOUT_CUB_PL
#define WAIT_TIMEOUT_CUB_PL `(10)`
The documentation for this class was generated from the following file cubrid/src/executables/util_service.c