Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scripts better error messages #759

Merged
merged 2 commits into from
Nov 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions scripts/endOfNight.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,12 @@ if [[ ${KEOGRAM} == "true" ]]; then
KEOGRAM_FILE="keogram-${DATE}.${EXTENSION}"
UPLOAD_FILE="${DATE_DIR}/keogram/${KEOGRAM_FILE}"

"${ALLSKY_HOME}/keogram" ${SIZE_FILTER} -d "${DATE_DIR}/" -e ${EXTENSION} -o "${UPLOAD_FILE}" ${KEOGRAM_EXTRA_PARAMETERS}
# In order for the shell to treat the single quotes correctly, need to run in separate bash
CMD="'${ALLSKY_HOME}/keogram' ${SIZE_FILTER} -d '${DATE_DIR}' -e ${EXTENSION} -o '${UPLOAD_FILE}' ${KEOGRAM_EXTRA_PARAMETERS}"
echo ${CMD} | bash
RETCODE=$?
test $RETCODE -eq 0 || echo "Command Failed: ${ALLSKY_HOME}/keogram" ${SIZE_FILTER} -d "${DATE_DIR}/" -e ${EXTENSION} -o "${UPLOAD_FILE}" ${KEOGRAM_EXTRA_PARAMETERS}
test $RETCODE -eq 0 || echo "Command Failed: ${CMD}"

if [[ ${UPLOAD_KEOGRAM} == "true" && ${RETCODE} = 0 ]] ; then
# If the user specified a different name for the destination file, use it.
if [ "${KEOGRAM_DESTINATION_NAME}" != "" ]; then
Expand All @@ -88,9 +91,11 @@ if [[ ${STARTRAILS} == "true" ]]; then
STARTRAILS_FILE="startrails-${DATE}.${EXTENSION}"
UPLOAD_FILE="${DATE_DIR}/startrails/${STARTRAILS_FILE}"

"${ALLSKY_HOME}/startrails" ${SIZE_FILTER} -d "${DATE_DIR}" -e ${EXTENSION} -b ${BRIGHTNESS_THRESHOLD} -o "${UPLOAD_FILE}"
CMD="'${ALLSKY_HOME}/startrails' ${SIZE_FILTER} -d '${DATE_DIR}' -e ${EXTENSION} -b ${BRIGHTNESS_THRESHOLD} -o '${UPLOAD_FILE}'"
echo ${CMD} | bash
RETCODE=$?
test $RETCODE -eq 0 || echo "Command Failed: ${ALLSKY_HOME}/startrails" ${SIZE_FILTER} -d "${DATE_DIR}" -e ${EXTENSION} -b ${BRIGHTNESS_THRESHOLD} -o "${UPLOAD_FILE}"
test $RETCODE -eq 0 || echo "Command Failed: ${CMD}"

if [[ ${UPLOAD_STARTRAILS} == "true" && ${RETCODE} == 0 ]] ; then
# If the user specified a different name for the destination file, use it.
if [ "${STARTRAILS_DESTINATION_NAME}" != "" ]; then
Expand All @@ -114,6 +119,7 @@ if [[ ${TIMELAPSE} == "true" ]]; then
echo -e "${ME}: ===== Generating Timelapse"
"${ALLSKY_SCRIPTS}/timelapse.sh" "${DATE}"
RETCODE=$?

if [[ ${UPLOAD_VIDEO} == "true" && ${RETCODE} == 0 ]] ; then
VIDEOS_FILE="allsky-${DATE}.mp4"
UPLOAD_FILE="${DATE_DIR}/${VIDEOS_FILE}"
Expand Down
21 changes: 16 additions & 5 deletions scripts/generateForDay.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ if [ "${DATE}" = "" ]; then
echo -e "${ME}: ${RED}ERROR: No date specified!${NC}"
usage_and_exit 1
fi
#### echo K=$DO_KEOGRAM, S=$DO_STARTRAILS, T=$DO_TIMELAPSE, DATE=$DATE
DATE_DIR="${ALLSKY_IMAGES}/${DATE}"
if [ ! -d "${DATE_DIR}" ] ; then
echo -e "${ME}: ${RED}ERROR: '${DATE_DIR}' not found!${NC}"
exit 2
fi
#### echo K=$DO_KEOGRAM, S=$DO_STARTRAILS, T=$DO_TIMELAPSE, DATE=$DATE

if [ "${DO_KEOGRAM}" = "true" ] ; then
KEOGRAM_FILE="keogram-${DATE}.${EXTENSION}"
Expand All @@ -93,8 +93,14 @@ if [ "${DO_KEOGRAM}" = "true" ] ; then
echo -e "===== Generating Keogram"
mkdir -p "${DATE_DIR}/keogram"

"${ALLSKY_HOME}/keogram" -d "${DATE_DIR}" -e ${EXTENSION} -o "${UPLOAD_FILE}" ${KEOGRAM_EXTRA_PARAMETERS}
[ $? -eq 0 ] && echo -e "Completed"
# In order for the shell to treat the single quotes correctly, need to run in separate bash
CMD="'${ALLSKY_HOME}/keogram' -d '${DATE_DIR}' -e ${EXTENSION} -o '${UPLOAD_FILE}' ${KEOGRAM_EXTRA_PARAMETERS}"
echo ${CMD} | bash
if [ $? -eq 0 ]; then
echo -e "Completed"
else
echo "Command Failed: ${CMD}"
fi
else
if [ -s "${UPLOAD_FILE}" ]; then
# If the user specified a different name for the destination file, use it.
Expand All @@ -121,8 +127,13 @@ if [ "${DO_STARTRAILS}" = "true" ] ; then
echo -e "===== Generating Startrails, threshold=${BRIGHTNESS_THRESHOLD}"
mkdir -p "${DATE_DIR}/startrails"

"${ALLSKY_HOME}/startrails" -d "${DATE_DIR}/" -e ${EXTENSION} -b "${BRIGHTNESS_THRESHOLD}" -o "${UPLOAD_FILE}"
[ $? -eq 0 ] && echo -e "Completed"
CMD="'${ALLSKY_HOME}/startrails' -Q 1 ${SIZE_FILTER} -d '${DATE_DIR}' -e ${EXTENSION} -b ${BRIGHTNESS_THRESHOLD} -o '${UPLOAD_FILE}'"
echo ${CMD} | bash
if [ $? -eq 0 ]; then
echo -e "Completed"
else
echo "Command Failed: ${CMD}"
fi
else
if [ -s "${UPLOAD_FILE}" ]; then
if [ "${STARTRAILS_DESTINATION_NAME}" != "" ]; then
Expand Down