* Add a separate option log_dir for the log directory.
This commit is contained in:
parent
b66f85936f
commit
bd22632840
@ -12,6 +12,8 @@ CONFIGMACRO="__CONFIG_H__"
|
|||||||
|
|
||||||
# Database path
|
# Database path
|
||||||
DB_PATH="/tmp/minidlna"
|
DB_PATH="/tmp/minidlna"
|
||||||
|
# Log path
|
||||||
|
LOG_PATH="${DB_PATH}"
|
||||||
|
|
||||||
# detecting the OS name and version
|
# detecting the OS name and version
|
||||||
OS_NAME=`uname -s`
|
OS_NAME=`uname -s`
|
||||||
@ -116,6 +118,7 @@ case $OS_NAME in
|
|||||||
OS_NAME=Debian
|
OS_NAME=Debian
|
||||||
OS_VERSION=`cat /etc/debian_version`
|
OS_VERSION=`cat /etc/debian_version`
|
||||||
OS_URL=http://www.debian.org/
|
OS_URL=http://www.debian.org/
|
||||||
|
LOG_PATH="/var/log"
|
||||||
# use lsb_release (Linux Standard Base) when available
|
# use lsb_release (Linux Standard Base) when available
|
||||||
LSB_RELEASE=`which lsb_release 2>/dev/null`
|
LSB_RELEASE=`which lsb_release 2>/dev/null`
|
||||||
if [ 0 -eq $? ]; then
|
if [ 0 -eq $? ]; then
|
||||||
@ -146,6 +149,10 @@ echo "/* full path of the file database */" >> ${CONFIGFILE}
|
|||||||
echo "#define DEFAULT_DB_PATH \"${DB_PATH}\"" >> ${CONFIGFILE}
|
echo "#define DEFAULT_DB_PATH \"${DB_PATH}\"" >> ${CONFIGFILE}
|
||||||
echo "" >> ${CONFIGFILE}
|
echo "" >> ${CONFIGFILE}
|
||||||
|
|
||||||
|
echo "/* full path of the log directory */" >> ${CONFIGFILE}
|
||||||
|
echo "#define DEFAULT_LOG_PATH \"${LOG_PATH}\"" >> ${CONFIGFILE}
|
||||||
|
echo "" >> ${CONFIGFILE}
|
||||||
|
|
||||||
echo "/* Comment the following line to use home made daemonize() func instead" >> ${CONFIGFILE}
|
echo "/* Comment the following line to use home made daemonize() func instead" >> ${CONFIGFILE}
|
||||||
echo " * of BSD daemon() */" >> ${CONFIGFILE}
|
echo " * of BSD daemon() */" >> ${CONFIGFILE}
|
||||||
echo "#define USE_DAEMON" >> ${CONFIGFILE}
|
echo "#define USE_DAEMON" >> ${CONFIGFILE}
|
||||||
|
14
minidlna.c
14
minidlna.c
@ -410,6 +410,18 @@ init(int argc, char * * argv)
|
|||||||
}
|
}
|
||||||
strncpy(db_path, path, PATH_MAX);
|
strncpy(db_path, path, PATH_MAX);
|
||||||
break;
|
break;
|
||||||
|
case UPNPLOGDIR:
|
||||||
|
path = realpath(ary_options[i].value, real_path);
|
||||||
|
if( !path )
|
||||||
|
path = (ary_options[i].value);
|
||||||
|
make_dir(path, S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO);
|
||||||
|
if( access(path, F_OK) != 0 )
|
||||||
|
{
|
||||||
|
DPRINTF(E_FATAL, L_GENERAL, "Log path not accessible! [%s]\n", path);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
strncpy(log_path, path, PATH_MAX);
|
||||||
|
break;
|
||||||
case UPNPINOTIFY:
|
case UPNPINOTIFY:
|
||||||
if( (strcmp(ary_options[i].value, "yes") != 0) && !atoi(ary_options[i].value) )
|
if( (strcmp(ary_options[i].value, "yes") != 0) && !atoi(ary_options[i].value) )
|
||||||
CLEARFLAG(INOTIFY_MASK);
|
CLEARFLAG(INOTIFY_MASK);
|
||||||
@ -624,7 +636,7 @@ init(int argc, char * * argv)
|
|||||||
#else
|
#else
|
||||||
if( access(db_path, F_OK) != 0 )
|
if( access(db_path, F_OK) != 0 )
|
||||||
make_dir(db_path, S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO);
|
make_dir(db_path, S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO);
|
||||||
sprintf(real_path, "%s/minidlna.log", db_path);
|
sprintf(real_path, "%s/minidlna.log", log_path);
|
||||||
log_init(real_path, "general,artwork,database,inotify,scanner,metadata,http,ssdp,tivo=warn");
|
log_init(real_path, "general,artwork,database,inotify,scanner,metadata,http,ssdp,tivo=warn");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ static const struct {
|
|||||||
{ UPNPALBUMART_NAMES, "album_art_names"},
|
{ UPNPALBUMART_NAMES, "album_art_names"},
|
||||||
{ UPNPINOTIFY, "inotify" },
|
{ UPNPINOTIFY, "inotify" },
|
||||||
{ UPNPDBDIR, "db_dir" },
|
{ UPNPDBDIR, "db_dir" },
|
||||||
|
{ UPNPLOGDIR, "log_dir" },
|
||||||
{ ENABLE_TIVO, "enable_tivo" },
|
{ ENABLE_TIVO, "enable_tivo" },
|
||||||
{ ENABLE_DLNA_STRICT, "strict_dlna" }
|
{ ENABLE_DLNA_STRICT, "strict_dlna" }
|
||||||
};
|
};
|
||||||
|
@ -26,7 +26,8 @@ enum upnpconfigoptions {
|
|||||||
UPNPMEDIADIR, /* directory to search for UPnP-A/V content */
|
UPNPMEDIADIR, /* directory to search for UPnP-A/V content */
|
||||||
UPNPALBUMART_NAMES, /* list of '/'-delimited file names to check for album art */
|
UPNPALBUMART_NAMES, /* list of '/'-delimited file names to check for album art */
|
||||||
UPNPINOTIFY, /* enable inotify on the media directories */
|
UPNPINOTIFY, /* enable inotify on the media directories */
|
||||||
UPNPDBDIR, /* base directory to store the database, log files, and album art cache */
|
UPNPDBDIR, /* base directory to store the database and album art cache */
|
||||||
|
UPNPLOGDIR, /* base directory to store the log file */
|
||||||
ENABLE_TIVO, /* enable support for streaming images and music to TiVo */
|
ENABLE_TIVO, /* enable support for streaming images and music to TiVo */
|
||||||
ENABLE_DLNA_STRICT /* strictly adhere to DLNA specs */
|
ENABLE_DLNA_STRICT /* strictly adhere to DLNA specs */
|
||||||
};
|
};
|
||||||
|
@ -45,6 +45,7 @@ sqlite3 * db;
|
|||||||
char dlna_no_conv[] = "DLNA.ORG_OP=01;DLNA.ORG_CI=0";
|
char dlna_no_conv[] = "DLNA.ORG_OP=01;DLNA.ORG_CI=0";
|
||||||
char friendly_name[FRIENDLYNAME_MAX_LEN];
|
char friendly_name[FRIENDLYNAME_MAX_LEN];
|
||||||
char db_path[PATH_MAX] = DEFAULT_DB_PATH;
|
char db_path[PATH_MAX] = DEFAULT_DB_PATH;
|
||||||
|
char log_path[PATH_MAX] = DEFAULT_LOG_PATH;
|
||||||
struct media_dir_s * media_dirs = NULL;
|
struct media_dir_s * media_dirs = NULL;
|
||||||
struct album_art_name_s * album_art_names = NULL;
|
struct album_art_name_s * album_art_names = NULL;
|
||||||
struct client_cache_s clients[CLIENT_CACHE_SLOTS];
|
struct client_cache_s clients[CLIENT_CACHE_SLOTS];
|
||||||
|
@ -123,6 +123,7 @@ extern char dlna_no_conv[];
|
|||||||
#define FRIENDLYNAME_MAX_LEN (64)
|
#define FRIENDLYNAME_MAX_LEN (64)
|
||||||
extern char friendly_name[];
|
extern char friendly_name[];
|
||||||
extern char db_path[];
|
extern char db_path[];
|
||||||
|
extern char log_path[];
|
||||||
extern struct media_dir_s * media_dirs;
|
extern struct media_dir_s * media_dirs;
|
||||||
extern struct album_art_name_s * album_art_names;
|
extern struct album_art_name_s * album_art_names;
|
||||||
extern struct client_cache_s clients[CLIENT_CACHE_SLOTS];
|
extern struct client_cache_s clients[CLIENT_CACHE_SLOTS];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user