Skip to content

Commit

Permalink
fix config pathing
Browse files Browse the repository at this point in the history
  • Loading branch information
Drazzilb08 committed Feb 19, 2024
1 parent e0965ce commit 8cb8d2c
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions scripts/backup_plex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,22 @@
quiet="False"
unraid_notify="False"

config_file() {
# if CONFIG_DIR
if [ -z "$log_dir" ]; then
config_dir="${CONFIG_DIR:-$(dirname "$0")/..}"
config_dir_setup() {
config_dir=${config_dir%/}

script_path=$(dirname "$0")
parent_dir=$(dirname "$script_path")

if [ -n "$DOCKER_ENV" ]; then
config_dir="/config"
else
config_dir="${Cconfig_dir:-$parent_dir/config}"
fi

config_file="$config_dir/backup-plex.conf"
}

config_file() {
# Check if config file exists
if [ -f "$config_file" ]; then
# Read config file
Expand Down Expand Up @@ -483,17 +493,14 @@ start_plex() {
main() {
# Check if config file is defined in command line arguments
handle_options "$@"
config_dir_setup
if [ "$use_config_file" == "True" ]; then
config_file
fi
hex_to_decimal "$bar_color"
check_config "$@"
last_plex_backup="$config_dir/.last_plex_backup.tmp"
# check for .last_plex_backup.tmp file and if it exists, read the file to get the last backup date
if [ ! -f "$last_plex_backup" ]; then
verbose_output "Creating last backup file"
touch "$last_plex_backup"
fi
# check for .last_plex_backup.tmp file and if it exists, read the file to get the last backup date

if [ -f "$last_plex_backup" ]; then
while IFS= read -r line; do
Expand Down

0 comments on commit 8cb8d2c

Please sign in to comment.