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