Fix false path

This commit is contained in:
Alexander Schäferdiek 2019-01-25 19:02:33 +01:00
parent 52e05aae33
commit 49f4b71bcd
7 changed files with 26 additions and 21 deletions

View file

@ -90,7 +90,7 @@ source_config() {
local configFallback=$2;
if [[ ! -f "$config" ]]; then
if [[ ! -f "$backupConfigFileFallback" ]]; then
if [[ ! -f "$configFallback" ]]; then
echo "No config file specified and could not find default in '$configFallback'!";
echo "";
usage;

View file

@ -32,7 +32,7 @@ source_config() {
local configFallback=$2;
if [[ ! -f "$config" ]]; then
if [[ ! -f "$backupConfigFileFallback" ]]; then
if [[ ! -f "$configFallback" ]]; then
echo "No config file specified and could not find default in '$configFallback'!";
echo "";
usage;

View file

@ -36,7 +36,7 @@ source_config() {
local configFallback=$2;
if [[ ! -f "$config" ]]; then
if [[ ! -f "$backupConfigFileFallback" ]]; then
if [[ ! -f "$configFallback" ]]; then
echo "No config file specified and could not find default in '$configFallback'!";
echo "";
usage;

View file

@ -37,7 +37,7 @@ source_config() {
local configFallback=$2;
if [[ ! -f "$config" ]]; then
if [[ ! -f "$backupConfigFileFallback" ]]; then
if [[ ! -f "$configFallback" ]]; then
echo "No config file specified and could not find default in '$configFallback'!";
echo "";
usage;

View file

@ -35,7 +35,7 @@ source_config() {
local configFallback=$2;
if [[ ! -f "$config" ]]; then
if [[ ! -f "$backupConfigFileFallback" ]]; then
if [[ ! -f "$configFallback" ]]; then
echo "No config file specified and could not find default in '$configFallback'!";
echo "";
usage;

View file

@ -32,7 +32,7 @@ source_config() {
local configFallback=$2;
if [[ ! -f "$config" ]]; then
if [[ ! -f "$backupConfigFileFallback" ]]; then
if [[ ! -f "$configFallback" ]]; then
echo "No config file specified and could not find default in '$configFallback'!";
echo "";
usage;

View file

@ -36,26 +36,31 @@ SYSTEMD_CHECK_USER=$(whoami)
SYSTEMD_CHECK_SERVICES=()
# check for config file
systemdCheckConfigFile=$1;
systemdCheckConfigFileFallback=$HOME/.systemd_check.conf;
source_config() {
local config=$1;
local configFallback=$2;
if [[ ! -f "$systemdCheckConfigFile" ]]; then
if [[ ! -f "$systemdCheckConfigFileFallback" ]]; then
echo "No config file specified and could not find default in '$systemdCheckConfigFileFallback'!";
if [[ ! -f "$config" ]]; then
if [[ ! -f "$configFallback" ]]; then
echo "No config file specified and could not find default in '$configFallback'!";
echo "";
usage;
exit 1;
else
systemdCheckConfigFile=$systemdCheckConfigFileFallback;
config=$configFallback;
fi
fi
fi
set -a;
source "$systemdCheckConfigFile";
set +a;
set -a;
source "$config";
set +a;
}
source_config "$1" "$HOME/.systemd_check.conf"
if [ ! -f $SYSTEMD_CHECK_LIST_FILE ]; then
echo "$SYSTEMD_CHECK_LIST_FILE doesn't exist. Add a file which holds one systemd service or timer per line.";
echo "";
usage;
exit 1;
fi