Update update_and_notification_command.txt

This commit is contained in:
Adil Sadqi 2024-05-24 10:51:31 +00:00
parent ddd54b89a1
commit 3a6aa8d679
1 changed files with 34 additions and 10 deletions

View File

@ -1,10 +1,34 @@
nano /usr/local/bin/ferox
========
#!/bin/bash
sudo /usr/bin/apt update && sudo /usr/bin/apt upgrade -y && \
curl -d "Your System Has Been Updated and Upgraded Successfully" https://ntfy.sahab.eu.org/ferox && \
curl "http://192.168.0.109:86/message?token=AtypyhKyIT1Gkqp" -F "title=FEROX" -F "message=Your System Has Been Updated and Upgraded Successfully" -F "priority=1"
========
chmod +x /usr/local/bin/ferox
nano /usr/local/bin/ferox
========
#!/bin/bash
sudo /usr/bin/apt update && sudo /usr/bin/apt upgrade -y && \
curl -d "Your System Has Been Updated and Upgraded Successfully" https://ntfy.sahab.eu.org/ferox && \
curl "http://192.168.0.109:86/message?token=AtypyhKyIT1Gkqp" -F "title=FEROX" -F "message=Your System Has Been Updated and Upgraded Successfully" -F "priority=1"
========
chmod +x /usr/local/bin/ferox
========
#!/bin/bash
# Update and upgrade the system
sudo /usr/bin/apt update && sudo /usr/bin/apt upgrade -y
# Check if the previous command was successful
if [ $? -eq 0 ]; then
# Get the current date and local time
datetime=$(date +"%Y-%m-%d %H:%M:%S")
# Prepare the message
message="System update and upgrade completed successfully on Ubuntu on $datetime"
# Send the notification to the first endpoint
curl -d "$message" https://ntfy.sahab.eu.org/asus
# Send the notification to the second endpoint
curl "http://127.0.0.1:86/message?token=AtypyhKyIT1Gkqp" -F "title=ASUS" -F "message=$message"
else
echo "System update and upgrade failed."
fi
========