fix(exec):Camera script and daily job script
[EVA-2020-02.git] / exec / nfg_run_daily_jobs.sh
1 #!/bin/bash
2 # Desc: A list of executables to be started every day at midnight.
3 # Usage: nfg_run_daily_jobs.sh arg1
4 # Input: arg1: path to directory containing ninfacyzga-1 repository
5 # Note: Run this script daily at midnight using `cron`.
6 # Depends: GNU Coreutils
7
8 script_path="$(dirname "$(realpath -s "$0")")"; # Get script dir Ref/Attrib: https://stackoverflowcom/questions/4774054/
9 nfg_base_dir="$script_path/../";
10 nfg_exec_dir="$nfg_base_dir"/exec;
11 length_day_s=$((24 * 60 * 60)); # seconds
12
13 yell() { echo "$0: $*" >&2; } # print script path and all args to stderr
14 die() { yell "$*"; exit 111; } # same as yell() but non-zero exit status
15 try() { "$@" || die "cannot $*"; } # runs args as command, reports args if command fails
16
17 # Note: Use '&' to run scripts and immediately detach them.
18
19 # Temperature
20
21 # Pressure
22
23 # Location
24
25 # Photograph
26 photo_script_path="$nfg_exec_dir"/photograph/update_temp_photograph.sh;
27 camera_name="DC1";
28 timeout "$length_day_s"s /bin/bash "$photo_script_path" "$camera_name" &