Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/processone/ejabberd.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Romain <christophe.romain@process-one.net>2014-07-02 12:41:12 +0400
committerChristophe Romain <christophe.romain@process-one.net>2014-07-03 01:46:54 +0400
commit9265720f923abfb97336a6ad1cd41287772aa728 (patch)
tree601dc6bf98992c920f10a3dd61b4dde96bf400a3 /ejabberdctl.template
parent273631c242646baca7ea62d723059973a7ad6839 (diff)
add ability to rotate logs on given date condition
Diffstat (limited to 'ejabberdctl.template')
-rwxr-xr-xejabberdctl.template18
1 files changed, 18 insertions, 0 deletions
diff --git a/ejabberdctl.template b/ejabberdctl.template
index 734efbf6a..f3ae9d866 100755
--- a/ejabberdctl.template
+++ b/ejabberdctl.template
@@ -126,6 +126,24 @@ else
NAME="-name"
fi
+# define ejabberd environment parameters
+if [ "$EJABBERD_CONFIG_PATH" != "${EJABBERD_CONFIG_PATH/.yml/}" ] ; then
+ rate=$(grep log_rate_limit $EJABBERD_CONFIG_PATH | cut -d':' -f2 | sed 's/ *//')
+ rotate=$(grep log_rotate_size $EJABBERD_CONFIG_PATH | cut -d':' -f2 | sed 's/ *//')
+ count=$(grep log_rotate_count $EJABBERD_CONFIG_PATH | cut -d':' -f2 | sed 's/ *//')
+ date=$(grep log_rotate_date $EJABBERD_CONFIG_PATH | cut -d':' -f2 | sed 's/ *//')
+else
+ rate=$(grep log_rate_limit $EJABBERD_CONFIG_PATH | cut -d',' -f2 | sed 's/ *//;s/}\.//')
+ rotate=$(grep log_rotate_size $EJABBERD_CONFIG_PATH | cut -d',' -f2 | sed 's/ *//;s/}\.//')
+ count=$(grep log_rotate_count $EJABBERD_CONFIG_PATH | cut -d',' -f2 | sed 's/ *//;s/}\.//')
+ date=$(grep log_rotate_date $EJABBERD_CONFIG_PATH | cut -d',' -f2 | sed 's/ *//;s/}\.//')
+fi
+[ -z "$rate" ] || EJABBERD_OPTS="log_rate_limit $rate"
+[ -z "$rotate" ] || EJABBERD_OPTS="${EJABBERD_OPTS} log_rotate_size $rotate"
+[ -z "$count" ] || EJABBERD_OPTS="${EJABBERD_OPTS} log_rotate_count $count"
+[ -z "$date" ] || EJABBERD_OPTS="${EJABBERD_OPTS} log_rotate_date '$date'"
+[ -z "$EJABBERD_OPTS" ] || EJABBERD_OPTS="-ejabberd ${EJABBERD_OPTS}"
+
# create the ejabberd home dir with the proper user if doesn't exist
# then change to that directory readable by INSTALLUSER to
# prevent "File operation error: eacces." messages