From 3a6aa8d679ac803ce49ea7142ddef8bd9dedaef2 Mon Sep 17 00:00:00 2001 From: Adil Sadqi Date: Fri, 24 May 2024 10:51:31 +0000 Subject: [PATCH] Update update_and_notification_command.txt --- update_and_notification_command.txt | 44 ++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/update_and_notification_command.txt b/update_and_notification_command.txt index 75d9068..2c4e899 100644 --- a/update_and_notification_command.txt +++ b/update_and_notification_command.txt @@ -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 \ No newline at end of file +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 +======== \ No newline at end of file