Brought it back

This commit is contained in:
Cyber 2024-06-19 08:35:24 +00:00
parent ac50c87b89
commit 9df9925c72
3 changed files with 22 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.api-key

View File

@ -12,3 +12,17 @@ if [[ hello -ne 200 ]]; then
echo "token not valid, exiting" echo "token not valid, exiting"
exit 1 exit 1
fi fi
echo $API_KEY > .api-key
[ ! which at ] && sudo apt install at
date=$(curl -sH "x-ssh-auth: $API_KEY" $API_HOST/time | grep -o '"expireDate":"[^"]*' | grep -o '[^"]*$')
echo atd >> /start.sh
atd
at -t $(date -d $date +'%Y%m%d%H%M') -f /root/container-expire-notifs/notify.sh
notif "Container expiration notifications brought back successfully!"
notif "**WRNING**: If your conainer is off you may not receive the reminder"

7
notify.sh Executable file
View File

@ -0,0 +1,7 @@
API_HOST="https://api.ssh.surf"
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."
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') -f /root/container-expire-notifs/notify.sh