refactor: move notify.sh script to /var/tools/container-expire-notifs

This commit is contained in:
Cyber 2024-07-25 06:03:41 +00:00
parent aee262aacc
commit b495eb0c69
2 changed files with 6 additions and 3 deletions

View File

@ -13,7 +13,10 @@ if [[ hello -ne 200 ]]; then
exit 1 exit 1
fi fi
echo $API_KEY > .api-key mkdir /var/tools/container-expire-notifs
cp /root/container-expire-notifs/notify.sh /var/tools/container-expire-notifs/notify.sh
echo $API_KEY > /var/tools/container-expire-notifs/.api-key
[ ! which at ] && sudo apt install at [ ! which at ] && sudo apt install at
@ -22,7 +25,7 @@ date=$(curl -sH "x-ssh-auth: $API_KEY" $API_HOST/time | grep -o '"expireDate":"[
[ if ! grep atd /start.sh ] sed -i -e 's/#s2lmain/atd/g' /start.sh [ if ! grep atd /start.sh ] sed -i -e 's/#s2lmain/atd/g' /start.sh
atd atd
at -t $(date -d $date +'%Y%m%d%H%M') -f /root/container-expire-notifs/notify.sh at -t $(date -d $date +'%Y%m%d%H%M') -f /var/tools/container-expire-notifs/notify.sh
notif "Container expiration notifications brought back successfully!" notif "Container expiration notifications brought back successfully!"
notif "**WARNING**: If your container is off you may not receive the reminder" notif "**WARNING**: If your container is off you may not receive the reminder"

View File

@ -4,4 +4,4 @@ API_KEY=$(cat .api-key)
notif "Hello, your container at SSH.SURF has hit its expire date, if not extended before 6PM EST the container will be removed automatically. Use /extend to gain another 7 days." notif "Hello, your container at SSH.SURF has hit its expire date, if not extended before 6PM EST the container will be removed automatically. Use /extend to gain another 7 days."
date=$(curl -sH "x-ssh-auth: $API_KEY" $API_HOST/time | grep -o '"expireDate":"[^"]*' | grep -o '[^"]*$') date=$(curl -sH "x-ssh-auth: $API_KEY" $API_HOST/time | grep -o '"expireDate":"[^"]*' | grep -o '[^"]*$')
at -t $(date -d $date +'%Y%m%d%H%M' -d "$end_date+7 days") -f /root/container-expire-notifs/notify.sh at -t $(date -d $date +'%Y%m%d%H%M' -d "$end_date+7 days") -f /var/tools/container-expire-notifs/notify.sh