Update update_and_notification_command.txt
This commit is contained in:
parent
ddd54b89a1
commit
3a6aa8d679
|
@ -8,3 +8,27 @@ curl "http://192.168.0.109:86/message?token=AtypyhKyIT1Gkqp" -F "title=FEROX" -F
|
||||||
|
|
||||||
========
|
========
|
||||||
chmod +x /usr/local/bin/ferox
|
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
|
||||||
|
========
|
Loading…
Reference in New Issue