littlejeem / monitor_scripts

A repository of scripts designed to monitor or oversea functions
GNU General Public License v3.0
0 stars 0 forks source link

services_checker.sh - selectable variables location #8

Closed littlejeem closed 4 years ago

littlejeem commented 4 years ago

in services_checker.sh intended selectable variables...

transmission-daemon=0
jackett="0"
lidarr="0"
sonarr="0"
radarr="0"

...are contained in the script, better to move to a config file.

littlejeem commented 4 years ago

testing 2b0a1d1 this shows the correct directory, now need to test in a root cron job

littlejeem commented 4 years ago

2b0a1d1 Results from this test are:

From root@pi_grown_up.home  Fri Jun 12 15:30:01 2020
Return-Path: <root@pi_grown_up.home>
X-Original-To: root
Delivered-To: root@pi_grown_up.home
Received: by pi_grown_up.home (Postfix, from userid 0)
    id 36FABA521B; Fri, 12 Jun 2020 15:30:01 +0100 (BST)
From: root@pi_grown_up.home (Cron Daemon)
To: root@pi_grown_up.home
Subject: Cron <root@pi_grown_up> /home/pi/bin/monitor_scripts/services_checker.sh
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>
Message-Id: <20200612143001.36FABA521B@pi_grown_up.home>
Date: Fri, 12 Jun 2020 15:30:01 +0100 (BST)

/home/pi/bin/monitor_scripts/services_checker.sh: 12: /home/pi/bin/monitor_scripts/services_checker.sh: transmission-daemon=1: not found
/home/pi/bin/monitor_scripts/services_checker.sh: 22: /home/pi/bin/monitor_scripts/services_checker.sh: Syntax error: "(" unexpected

Need to look into this more...

littlejeem commented 4 years ago

commenting out

#service_name="transmisson-daemon"
#service_selection=${transmission-daemon}
#check_selection

prevents...

/home/pi/bin/monitor_scripts/services_checker.sh: 12: /home/pi/bin/monitor_scripts/services_checker.sh: transmission-daemon=1: not found

...for testing purposes

littlejeem commented 4 years ago

re-ran test via root crontab, altering incorrect shebang, log generated results as expected

#
-----------------------------------------------------------------------------
script STARTED

I would source /config.sh in real world
jackett is NOT selected for checking
lidarr is NOT selected for checking
sonarr is NOT selected for checking
radarr is NOT selected for checking
script ENDED
-----------------------------------------------------------------------------
#