Added configure option --pid=FILE.
A pid file name can be relative. The default pid file name is "nginext.pid".
This commit is contained in:
@@ -13,6 +13,7 @@ NXT_CC_OPT=
|
|||||||
NXT_LD_OPT=
|
NXT_LD_OPT=
|
||||||
|
|
||||||
NXT_PREFIX=
|
NXT_PREFIX=
|
||||||
|
NXT_PID="nginext.pid"
|
||||||
NXT_LOG="nginext.log"
|
NXT_LOG="nginext.log"
|
||||||
|
|
||||||
NXT_DEBUG=NO
|
NXT_DEBUG=NO
|
||||||
@@ -58,6 +59,7 @@ do
|
|||||||
--build-dir=*) NXT_BUILD_DIR="$value" ;;
|
--build-dir=*) NXT_BUILD_DIR="$value" ;;
|
||||||
|
|
||||||
--prefix=*) NXT_PREFIX="$value" ;;
|
--prefix=*) NXT_PREFIX="$value" ;;
|
||||||
|
--pid=*) NXT_PID="$value" ;;
|
||||||
--log=*) NXT_LOG="$value" ;;
|
--log=*) NXT_LOG="$value" ;;
|
||||||
|
|
||||||
--debug) NXT_DEBUG=YES ;;
|
--debug) NXT_DEBUG=YES ;;
|
||||||
@@ -107,6 +109,11 @@ case "$NXT_PREFIX" in
|
|||||||
*) NXT_PREFIX="$NXT_PREFIX/" ;;
|
*) NXT_PREFIX="$NXT_PREFIX/" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
case "$NXT_PID" in
|
||||||
|
/*) ;;
|
||||||
|
*) NXT_PID="$NXT_PREFIX$NXT_PID" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
case "$NXT_LOG" in
|
case "$NXT_LOG" in
|
||||||
/*) ;;
|
/*) ;;
|
||||||
*) NXT_LOG="$NXT_PREFIX$NXT_LOG" ;;
|
*) NXT_LOG="$NXT_PREFIX$NXT_LOG" ;;
|
||||||
|
|||||||
1
configure
vendored
1
configure
vendored
@@ -63,6 +63,7 @@ cat << END >> $NXT_AUTO_CONFIG_H
|
|||||||
#define NXT_SYSTEM_VERSION "$NXT_SYSTEM $NXT_SYSTEM_VERSION $NXT_SYSTEM_PLATFORM"
|
#define NXT_SYSTEM_VERSION "$NXT_SYSTEM $NXT_SYSTEM_VERSION $NXT_SYSTEM_PLATFORM"
|
||||||
#define NXT_COMPILER_VERSION "$NXT_CC_VERSION"
|
#define NXT_COMPILER_VERSION "$NXT_CC_VERSION"
|
||||||
|
|
||||||
|
#define NXT_PID "$NXT_PID"
|
||||||
#define NXT_LOG "$NXT_LOG"
|
#define NXT_LOG "$NXT_LOG"
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|||||||
@@ -78,13 +78,6 @@ nxt_runtime_create(nxt_task_t *task)
|
|||||||
|
|
||||||
nxt_thread_mutex_create(&rt->processes_mutex);
|
nxt_thread_mutex_create(&rt->processes_mutex);
|
||||||
|
|
||||||
rt->prefix = nxt_current_directory(mp);
|
|
||||||
if (nxt_slow_path(rt->prefix == NULL)) {
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
rt->conf_prefix = rt->prefix;
|
|
||||||
|
|
||||||
rt->services = nxt_services_init(mp);
|
rt->services = nxt_services_init(mp);
|
||||||
if (nxt_slow_path(rt->services == NULL)) {
|
if (nxt_slow_path(rt->services == NULL)) {
|
||||||
goto fail;
|
goto fail;
|
||||||
@@ -698,7 +691,6 @@ static nxt_int_t
|
|||||||
nxt_runtime_conf_init(nxt_task_t *task, nxt_runtime_t *rt)
|
nxt_runtime_conf_init(nxt_task_t *task, nxt_runtime_t *rt)
|
||||||
{
|
{
|
||||||
nxt_int_t ret;
|
nxt_int_t ret;
|
||||||
nxt_str_t *prefix;
|
|
||||||
nxt_file_t *file;
|
nxt_file_t *file;
|
||||||
nxt_file_name_str_t file_name;
|
nxt_file_name_str_t file_name;
|
||||||
const nxt_event_interface_t *interface;
|
const nxt_event_interface_t *interface;
|
||||||
@@ -709,7 +701,7 @@ nxt_runtime_conf_init(nxt_task_t *task, nxt_runtime_t *rt)
|
|||||||
rt->auxiliary_threads = 2;
|
rt->auxiliary_threads = 2;
|
||||||
rt->user_cred.user = "nobody";
|
rt->user_cred.user = "nobody";
|
||||||
rt->group = NULL;
|
rt->group = NULL;
|
||||||
rt->pid = "nginext.pid";
|
rt->pid = NXT_PID;
|
||||||
rt->log = NXT_LOG;
|
rt->log = NXT_LOG;
|
||||||
|
|
||||||
if (nxt_runtime_conf_read_cmd(task, rt) != NXT_OK) {
|
if (nxt_runtime_conf_read_cmd(task, rt) != NXT_OK) {
|
||||||
@@ -733,10 +725,7 @@ nxt_runtime_conf_init(nxt_task_t *task, nxt_runtime_t *rt)
|
|||||||
|
|
||||||
rt->engine = interface->name;
|
rt->engine = interface->name;
|
||||||
|
|
||||||
prefix = nxt_file_name_is_absolute(rt->pid) ? NULL : rt->prefix;
|
ret = nxt_file_name_create(rt->mem_pool, &file_name, "s%Z", rt->pid);
|
||||||
|
|
||||||
ret = nxt_file_name_create(rt->mem_pool, &file_name, "%V%s%Z",
|
|
||||||
prefix, rt->pid);
|
|
||||||
if (nxt_slow_path(ret != NXT_OK)) {
|
if (nxt_slow_path(ret != NXT_OK)) {
|
||||||
return NXT_ERROR;
|
return NXT_ERROR;
|
||||||
}
|
}
|
||||||
@@ -768,6 +757,7 @@ nxt_runtime_conf_read_cmd(nxt_task_t *task, nxt_runtime_t *rt)
|
|||||||
"nginext version: " NXT_VERSION "\n"
|
"nginext version: " NXT_VERSION "\n"
|
||||||
"configured as ./configure" NXT_CONFIGURE_OPTIONS "\n";
|
"configured as ./configure" NXT_CONFIGURE_OPTIONS "\n";
|
||||||
|
|
||||||
|
static const char no_pid[] = "option \"--pid\" requires filename\n";
|
||||||
static const char no_log[] = "option \"--log\" requires filename\n";
|
static const char no_log[] = "option \"--log\" requires filename\n";
|
||||||
|
|
||||||
argv = &nxt_process_argv[1];
|
argv = &nxt_process_argv[1];
|
||||||
@@ -843,8 +833,7 @@ nxt_runtime_conf_read_cmd(nxt_task_t *task, nxt_runtime_t *rt)
|
|||||||
|
|
||||||
if (nxt_strcmp(p, "--pid") == 0) {
|
if (nxt_strcmp(p, "--pid") == 0) {
|
||||||
if (*argv == NULL) {
|
if (*argv == NULL) {
|
||||||
nxt_log(task, NXT_LOG_CRIT,
|
write(STDERR_FILENO, no_pid, sizeof(no_pid) - 1);
|
||||||
"no argument for option \"--pid\"");
|
|
||||||
return NXT_ERROR;
|
return NXT_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,9 +24,6 @@ struct nxt_runtime_s {
|
|||||||
|
|
||||||
nxt_runtime_cont_t start;
|
nxt_runtime_cont_t start;
|
||||||
|
|
||||||
nxt_str_t *conf_prefix;
|
|
||||||
nxt_str_t *prefix;
|
|
||||||
|
|
||||||
nxt_str_t hostname;
|
nxt_str_t hostname;
|
||||||
|
|
||||||
nxt_file_name_t *pid_file;
|
nxt_file_name_t *pid_file;
|
||||||
|
|||||||
Reference in New Issue
Block a user