Server IP : 184.154.167.98 / Your IP : 18.226.17.3 Web Server : Apache System : Linux pink.dnsnetservice.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 User : puertode ( 1767) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/sbin/ |
Upload File : |
#!/bin/bash # Function to send Slack notification send_slack_notification() { SLACK_WEBHOOK_URL="https://hooks.slack.com/services/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" SLACK_CHANNEL="#backups" # Replace with your actual channel name USERNAME="${HOSTNAME}_Shared_Account_Backup" MESSAGE="$1" JSON="{ \"username\":\"$USERNAME\", \"channel\":\"$SLACK_CHANNEL\", \"attachments\":[{\"color\":\"warning\" , \"text\": \"$MESSAGE\"}]}" curl -s -d "payload=$JSON" "$SLACK_WEBHOOK_URL" } # Function to perform the backup process run_backup() { # Send Slack notification: backup started send_slack_notification "Shared account backup has started for $shared_account." # Run the backup command for the shared account directly /scripts/pkgacct $shared_account >/dev/null 2>&1 & # Wait for the background process to finish (to ensure the backup completes) wait $! # Move the resulting backup to the shared account backup directory mv /home/cpmove-$shared_account.tar.gz /home/whwteam/shared_backups/ # Send Slack notification: backup completed send_slack_notification "Shared account backup has completed for $shared_account. Please terminate the account from WHM and add notes in billing." } # Prompt for shared account name echo "Please provide Shared account name: " read shared_account exec > /dev/null 2>&1 # Run the backup process in the background (run_backup &)