From 1b0599cddcf8ed7f2b1f2f7506f312f8517ac434 Mon Sep 17 00:00:00 2001 From: RaspbianProyect by HP3ICC Date: Tue, 21 Feb 2023 20:42:13 +0000 Subject: [PATCH] Update install.sh --- install.sh | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 124c4de..b1ba335 100644 --- a/install.sh +++ b/install.sh @@ -13,7 +13,31 @@ sudo apt-get install git -y apt-get install sudo -y apt install python3 python3-pip python3-dev libffi-dev libssl-dev cargo sed -y apt install default-libmysqlclient-dev build-essential -y -######################### +###################################################################################################################### +# Cronedit +###################################################################################################################### +cat > /usr/local/bin/cronedit.sh <<- "EOF" +cronjob_editor () { +# usage: cronjob_editor '' '' + +if [[ -z "$1" ]] ;then printf " no interval specified\n" ;fi +if [[ -z "$2" ]] ;then printf " no command specified\n" ;fi +if [[ -z "$3" ]] ;then printf " no action specified\n" ;fi + +if [[ "$3" == add ]] ;then + # add cronjob, no duplication: + ( sudo crontab -l | grep -v -F -w "$2" ; echo "$1 $2" ) | sudo crontab - +elif [[ "$3" == remove ]] ;then + # remove cronjob: + ( sudo crontab -l | grep -v -F -w "$2" ) | sudo crontab - +fi +} +cronjob_editor "$1" "$2" "$3" + + +EOF +sudo chmod +x /usr/local/bin/cronedit.sh + if [ -f "/var/www/html/tgcount.php" ]; then sudo systemctl stop apache2 @@ -640,8 +664,7 @@ sudo sed -i "s/All rights reserved.
.*/All rights reserved.
/lib/systemd/system/proxy.service <<- "EOF" @@ -776,6 +799,8 @@ sudo systemctl stop freedmr.service sudo systemctl start freedmr.service sudo systemctl enable freedmr.service ;; 6) +cronedit.sh '*/5 * * * *' 'sh /opt/FDMR-Monitor/sysinfo/graph.sh' add +cronedit.sh '*/2 * * * *' 'sh /opt/FDMR-Monitor/sysinfo/cpu.sh' add sudo systemctl start mariadb.service sudo systemctl enable mariadb.service sudo systemctl stop fdmr_mon.service @@ -794,6 +819,8 @@ sudo systemctl disable freedmr.service sudo systemctl stop mariadb.service sudo systemctl disable mariadb.service ;; 8) +cronedit.sh '*/5 * * * *' 'sh /opt/FDMR-Monitor/sysinfo/graph.sh' remove +cronedit.sh '*/2 * * * *' 'sh /opt/FDMR-Monitor/sysinfo/cpu.sh' remove sudo systemctl stop fdmr_mon.service sudo systemctl disable fdmr_mon.service sudo systemctl stop http.server-fdmr.service