Update functions.bash

This commit is contained in:
RandomNinjaAtk 2023-07-20 10:49:16 +00:00 committed by GitHub
parent bb4256c28d
commit d12c4a8376
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,14 +1,15 @@
log () { log () {
m_time=`date "+%F %T"` m_time=`date "+%F %T"`
echo $m_time" :: $scriptName :: $scriptVersion :: "$1 echo $m_time" :: $scriptName :: $scriptVersion :: "$1
echo $m_time" :: $scriptName :: $scriptVersion :: "$1 >> /config/logs/$scriptName.txt
} }
logfileSetup () { logfileSetup () {
# auto-clean up log file to reduce space usage # auto-clean up log file to reduce space usage
if [ -f "/config/logs/$scriptName.txt" ]; then if [ -f "/config/logs/$scriptName.txt" ]; then
if find /config/logs -type f -name "$scriptName.txt" -size +1024k | read; then if find /config/logs -type f -name "$scriptName.txt" -size +1024k | read; then
echo "" > /config/logs/$scriptName.txt echo "" > /config/logs/$scriptName.txt
fi fi
fi fi
if [ ! -f "/config/logs/$scriptName.txt" ]; then if [ ! -f "/config/logs/$scriptName.txt" ]; then