mirror of
https://github.com/cimryan/teslausb.git
synced 2026-03-01 04:30:33 +00:00
Better error checking.
This commit is contained in:
@@ -81,8 +81,11 @@ function move_clips_to_archive () {
|
|||||||
|
|
||||||
done
|
done
|
||||||
log "Moved $move_count file(s)."
|
log "Moved $move_count file(s)."
|
||||||
log "Sending Pushover message"
|
if [ -r "/root/.teslaCamPushoverCredentials" ]
|
||||||
/root/bin/send-pushover.sh $move_count
|
then
|
||||||
|
log "Sending Pushover message for copied files."
|
||||||
|
/root/bin/send-pushover.sh $move_count
|
||||||
|
fi
|
||||||
log "Finished moving clips to archive."
|
log "Finished moving clips to archive."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
#!/bin/bash -eu
|
#!/bin/bash -eu
|
||||||
|
|
||||||
|
function log () {
|
||||||
|
echo "$( date )" >> "$LOG_FILE"
|
||||||
|
echo "$1" >> "$LOG_FILE"
|
||||||
|
}
|
||||||
|
|
||||||
source /root/.teslaCamPushoverCredentials
|
source /root/.teslaCamPushoverCredentials
|
||||||
|
|
||||||
curl -F "token=$pushover_app_key" \
|
curl -F "token=$pushover_app_key" \
|
||||||
|
|||||||
@@ -27,25 +27,21 @@ check_variable "campercent"
|
|||||||
function check_pushover_enabled () {
|
function check_pushover_enabled () {
|
||||||
if [ -n "${pushover_enabled+x}" ]
|
if [ -n "${pushover_enabled+x}" ]
|
||||||
then
|
then
|
||||||
if [[ -z "${pushover_user_key+x}" ]] || [[ -z "${pushover_app_key+x}" ]]
|
if [ ! -n "${pushover_user_key+x}" ] || [ ! -n "${pushover_app_key+x}" ]
|
||||||
then
|
then
|
||||||
echo "STOP: You're trying to setup Pushover but didn't provide your User and/or App key."
|
echo "STOP: You're trying to setup Pushover but didn't provide your User and/or App key."
|
||||||
echo "Define the variables like this:"
|
echo "Define the variables like this:"
|
||||||
echo "export pushover_user_key=your_user_key_here"
|
echo "export pushover_user_key=put_your_userkey_here"
|
||||||
echo "export pushover_app_key=your_app_key_here"
|
echo "export pushover_app_key=put_your_appkey_here"
|
||||||
exit 1
|
exit 1
|
||||||
elif [[ "${pushover_user_key}" = "put_your_user_key_here" ]] || [[ "${pushover_app_key}" = "put_your_app_key_here" ]]
|
elif [ "${pushover_user_key}" = "put_your_userkey_here" ] || [ "${pushover_app_key}" = "put_your_appkey_here" ]
|
||||||
then
|
then
|
||||||
echo "STOP: You're trying to setup Pushover but didn't replace the default User and App key values."
|
echo "STOP: You're trying to setup Pushover, but didn't replace the default User and App key values."
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "export pushover_enabled=true" > /root/.teslaCamPushoverCredentials
|
echo "export pushover_enabled=true" > /root/bin/.teslaCamPushoverCredentials
|
||||||
echo "export pushover_user_key=$pushover_user_key" >> /root/.teslaCamPushoverCredentials
|
echo "export pushover_user_key=$pushover_user_key" >> /root/.teslaCamPushoverCredentials
|
||||||
echo "export pushover_app_key=$pushover_app_key" >> /root/.teslaCamPushoverCredentials
|
echo "export pushover_app_key=$pushover_app_key" >> /root/.teslaCamPushoverCredentials
|
||||||
pushd /root/bin
|
|
||||||
wget https://raw.githubusercontent.com/"$TESLAUSB_REPO"/teslausb/"$TESLAUSB_BRANCH"/windows_archive/send-pushover
|
|
||||||
chmod +x send-pushover
|
|
||||||
popd
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user