mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2025-06-30 22:18:19 -04:00
Update: Allow update of pidfile on the fly.
This commit is contained in:
parent
a2763ac9e4
commit
6f7881a875
@ -6,6 +6,7 @@ bin_PROGRAMS = icecast
|
|||||||
|
|
||||||
noinst_HEADERS = \
|
noinst_HEADERS = \
|
||||||
admin.h \
|
admin.h \
|
||||||
|
main.h \
|
||||||
cfgfile.h \
|
cfgfile.h \
|
||||||
logging.h \
|
logging.h \
|
||||||
sighandler.h \
|
sighandler.h \
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
#include "fserve.h"
|
#include "fserve.h"
|
||||||
#include "stats.h"
|
#include "stats.h"
|
||||||
#include "connection.h"
|
#include "connection.h"
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
#define CATMODULE "CONFIG"
|
#define CATMODULE "CONFIG"
|
||||||
#define CONFIG_DEFAULT_LOCATION "Earth"
|
#define CONFIG_DEFAULT_LOCATION "Earth"
|
||||||
@ -701,6 +702,7 @@ void config_reread_config(void)
|
|||||||
config_set_config(&new_config);
|
config_set_config(&new_config);
|
||||||
config = config_get_config_unlocked();
|
config = config_get_config_unlocked();
|
||||||
restart_logging(config);
|
restart_logging(config);
|
||||||
|
main_config_reload(config);
|
||||||
connection_reread_config(config);
|
connection_reread_config(config);
|
||||||
yp_recheck_config(config);
|
yp_recheck_config(config);
|
||||||
fserve_recheck_mime_types(config);
|
fserve_recheck_mime_types(config);
|
||||||
|
11
src/main.c
11
src/main.c
@ -60,6 +60,7 @@
|
|||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "main.h"
|
||||||
#include "cfgfile.h"
|
#include "cfgfile.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "sighandler.h"
|
#include "sighandler.h"
|
||||||
@ -86,6 +87,8 @@
|
|||||||
static int background;
|
static int background;
|
||||||
static char *pidfile = NULL;
|
static char *pidfile = NULL;
|
||||||
|
|
||||||
|
static void pidfile_update(ice_config_t *config, int always_try);
|
||||||
|
|
||||||
static void _fatal_error(const char *perr)
|
static void _fatal_error(const char *perr)
|
||||||
{
|
{
|
||||||
#ifdef WIN32_SERVICE
|
#ifdef WIN32_SERVICE
|
||||||
@ -162,6 +165,12 @@ static void shutdown_subsystems(void)
|
|||||||
xslt_shutdown();
|
xslt_shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void main_config_reload(ice_config_t *config)
|
||||||
|
{
|
||||||
|
ICECAST_LOG_DEBUG("Reloading configuration.");
|
||||||
|
pidfile_update(config, 0);
|
||||||
|
}
|
||||||
|
|
||||||
static int _parse_config_opts(int argc, char **argv, char *filename, size_t size)
|
static int _parse_config_opts(int argc, char **argv, char *filename, size_t size)
|
||||||
{
|
{
|
||||||
int i = 1;
|
int i = 1;
|
||||||
@ -365,7 +374,7 @@ static void pidfile_update(ice_config_t *config, int always_try)
|
|||||||
fprintf(f, "%lld\n", (long long int)getpid());
|
fprintf(f, "%lld\n", (long long int)getpid());
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
ICECAST_LOG_INFO("pidfile %H updated.");
|
ICECAST_LOG_INFO("pidfile %H updated.", pidfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newpidfile != pidfile) {
|
if (newpidfile != pidfile) {
|
||||||
|
16
src/main.h
Normal file
16
src/main.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
/* Icecast
|
||||||
|
*
|
||||||
|
* This program is distributed under the GNU General Public License, version 2.
|
||||||
|
* A copy of this license is included with this source.
|
||||||
|
*
|
||||||
|
* Copyright 2018, Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>,
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __MAIN_H__
|
||||||
|
#define __MAIN_H__
|
||||||
|
|
||||||
|
#include "cfgfile.h"
|
||||||
|
|
||||||
|
void main_config_reload(ice_config_t *config);
|
||||||
|
|
||||||
|
#endif
|
Loading…
x
Reference in New Issue
Block a user