From 5ed9244771f6c08bf9326eb8b11b36773302feca Mon Sep 17 00:00:00 2001 From: frju365 Date: Tue, 21 Aug 2018 02:11:19 +0200 Subject: [PATCH] [fix] log_erase --- scripts/_common.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/scripts/_common.sh b/scripts/_common.sh index 9e644f3..fd17263 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -198,6 +198,25 @@ EOF #================================================= +# Erase + +tempus_log_erase { + cat > "/etc/cron.daily/tempus_log_erase" << EOF +#!/bin/bash +log=/var/log/$app/osjs.log +size_log=$(ls -lh $log| cut -d " " -f5 | tr -d "K" | tr -d "M") +if [ $size_log >= 1 ] +then + rm $log + touch $log + chown $app $log +fi +EOF + +} + + +#================================================= # Start or restart a service and follow its booting # # usage: ynh_check_starting "Line to match" [Log file] [Timeout] [Service name]