Backup automatico script del 2026-10-27 07:00
This commit is contained in:
1 parent
a8ddcdd255
commit
ab1e545613
1 file changed
+25
Executable
+25
@@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Set curl command to update the IP
|
||||||
|
command="curl https://api.dnsexit.com/dns/ud/?apikey=2r6YilHU9YzFt2vKBT4W8A347e7w3G -d host=loogle.it,assd.sm"
|
||||||
|
|
||||||
|
if [ -d "/var/log" ]; then
|
||||||
|
command="$command >> /var/log/ipupdate.log"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get the existing crontab content
|
||||||
|
existing_crontab=$(crontab -l 2>/dev/null)
|
||||||
|
|
||||||
|
# Check if the command is already in crontab
|
||||||
|
if [[ $existing_crontab == *"$command"* ]]; then
|
||||||
|
echo "Scheduled job already exists in crontab."
|
||||||
|
else
|
||||||
|
# Add the scheduled job to the existing crontab content
|
||||||
|
new_crontab="${existing_crontab}
|
||||||
|
*/12 * * * * $command"
|
||||||
|
|
||||||
|
# Install the modified crontab
|
||||||
|
echo "$new_crontab" | crontab -
|
||||||
|
echo "The following job has been added to crontab. You may use command "crontab -l" to view the job"
|
||||||
|
crontab -l | grep curl
|
||||||
|
fi
|
||||||