mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Support logfiles not ending with .log in logrotate ...
This commit is contained in:
parent
c7c4d93968
commit
24cc26d85a
1 changed files with 7 additions and 4 deletions
|
@ -40,10 +40,13 @@ ynh_use_logrotate () {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $# -gt 0 ] && [ "$(echo ${1:0:1})" != "-" ]; then
|
if [ $# -gt 0 ] && [ "$(echo ${1:0:1})" != "-" ]; then
|
||||||
if [ "$(echo ${1##*.})" == "log" ]; then # Keep only the extension to check if it's a logfile
|
# If the given logfile parameter already exists as a file, or if it ends up with ".log",
|
||||||
local logfile=$1 # In this case, focus logrotate on the logfile
|
# we just want to manage a single file
|
||||||
|
if [ -f "$1" ] || [ "$(echo ${1##*.})" == "log" ]; then
|
||||||
|
local logfile=$1
|
||||||
|
# Otherwise we assume we want to manage a directory and all its .log file inside
|
||||||
else
|
else
|
||||||
local logfile=$1/*.log # Else, uses the directory and all logfile into it.
|
local logfile=$1/*.log
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# LEGACY CODE
|
# LEGACY CODE
|
||||||
|
@ -54,7 +57,7 @@ ynh_use_logrotate () {
|
||||||
fi
|
fi
|
||||||
if [ -n "$logfile" ]
|
if [ -n "$logfile" ]
|
||||||
then
|
then
|
||||||
if [ "$(echo ${logfile##*.})" != "log" ]; then # Keep only the extension to check if it's a logfile
|
if [ ! -f "$1" ] && [ "$(echo ${logfile##*.})" != "log" ]; then # Keep only the extension to check if it's a logfile
|
||||||
local logfile="$logfile/*.log" # Else, uses the directory and all logfile into it.
|
local logfile="$logfile/*.log" # Else, uses the directory and all logfile into it.
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Reference in a new issue