From a4c49e2a024f73000baf0228a2da8f68c4931e84 Mon Sep 17 00:00:00 2001 From: Steven Baltakatei Sandoval Date: Mon, 18 Oct 2021 07:49:30 +0000 Subject: [PATCH 1/1] fix(exec):Camera script and daily job script --- exec/nfg_run_daily_jobs.sh | 6 ++++-- exec/photograph/update_temp_photograph.sh | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/exec/nfg_run_daily_jobs.sh b/exec/nfg_run_daily_jobs.sh index d1b036f..5ba3923 100755 --- a/exec/nfg_run_daily_jobs.sh +++ b/exec/nfg_run_daily_jobs.sh @@ -3,8 +3,10 @@ # Usage: nfg_run_daily_jobs.sh arg1 # Input: arg1: path to directory containing ninfacyzga-1 repository # Note: Run this script daily at midnight using `cron`. +# Depends: GNU Coreutils -nfg_base_dir="../"; +script_path="$(dirname "$(realpath -s "$0")")"; # Get script dir Ref/Attrib: https://stackoverflowcom/questions/4774054/ +nfg_base_dir="$script_path/../"; nfg_exec_dir="$nfg_base_dir"/exec; length_day_s=$((24 * 60 * 60)); # seconds @@ -21,6 +23,6 @@ try() { "$@" || die "cannot $*"; } # runs args as command, reports args if comma # Location # Photograph -photo_script_path="$nfg_exec_dir"/update_temp_photograph.sh; +photo_script_path="$nfg_exec_dir"/photograph/update_temp_photograph.sh; camera_name="DC1"; timeout "$length_day_s"s /bin/bash "$photo_script_path" "$camera_name" & diff --git a/exec/photograph/update_temp_photograph.sh b/exec/photograph/update_temp_photograph.sh index 0489b8d..5b380c3 100755 --- a/exec/photograph/update_temp_photograph.sh +++ b/exec/photograph/update_temp_photograph.sh @@ -9,7 +9,9 @@ temp_dir="/dev/shm"; # default iso_date="$(date +%Y%m%dT%H%M%S%z)"; #iso_date_ns="$(date +%Y%m%dT%H%M%S.%N%z)"; device_hostname="$(hostname)"; -nfg_base_dir="../../"; # root directory of ninfacyzga-1 git repo + +script_path="$(dirname "$(realpath -s "$0")")"; # Get script dir Ref/Attrib: https://stackoverflowcom/questions/4774054/ +nfg_base_dir="$script_path/../../"; # root directory of ninfacyzga-1 git repo nfg_unitproc_path="$nfg_base_dir"/exec/unitproc; sleep_rand_path="$nfg_base_dir"/exec/unitproc/sleepRand.py; PATH="$nfg_unitproc_path:$PATH"; # include unitprocess nfg executables -- 2.30.2