- 1
- 0
- NAS
- DS 718+, DS 716+II
- Router
- RT2600ac
- Operating system
- Windows
- Mobile operating system
- iOS
I have both a DS 718+ and DS 716+II. I'm trying to make something work and I'm a bit out over my skis. I thought I'd check with the experts here to see if I am on the right track, or, headed for a crash.
Synology user for 13 years. NOT a linux expert. Don't know CLI syntax/commands but follow advice and commands and use it when necessary.
I have two Syno NAS -- one for my business -- one for personal. Have business internet with 5 IP addresses. Two routers on different IPs for domain ID purposes so they really are separate networks. Just had my first power crash in 13 years. Rebuilding the business NAS now -- had backups fortunately.
To prevent this problem in the future I bought a UPS that could support both NAS -- but -- I didn't think about the fact they are on separate networks. Only one USB port for connection. So, while ONE NAS and the routers can be on the UPS, I don't think I can put the second on and use the DSM integrated UPS management.
I was thinking that perhaps I could have one of the NAS -- the one that won't be connected via DSM -- PING the other NAS (and a couple of other sites like google and facebook), periodically, and if they are down, to automatically shut down. If I pinged say every 8 minutes and had a 5 minute shut down on the primary, I should be able to run for say 20-30 mins and eventually the pings won't work and it will shut down. I asked ChatGPT to help me craft a script to put into the "remote" NAS Task Scheduler and it gave me the following: MY QUESTION: Does this look like it would work, AND, is there any danger to putting this script in? Any thoughts would be appreciated. Thanks in advance!
ChatGPT's script:
#!/bin/sh
SITES=("example1.com" "example2.com" "example3.com") # Replace with the domains you want to ping
PING_COUNT=1
PING_INTERVAL=15
TOTAL_DURATION=120
SLEEP_TIME=480 # 8 minutes in seconds
while true; do
end_time=$((SECONDS + TOTAL_DURATION))
all_unresponsive=true
while [ $SECONDS -lt $end_time ]; do
for SITE in "${SITES[@]}"; do
count=$(ping -c $PING_COUNT $SITE | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }')
if [ $count -ne 0 ]; then
all_unresponsive=false
break
fi
done
if ! $all_unresponsive; then
break
fi
sleep $PING_INTERVAL
done
It then says to make the script executable using this:
chmod +x /path/to/your/script.sh
Finally these are the chatGPT instructions:
Synology user for 13 years. NOT a linux expert. Don't know CLI syntax/commands but follow advice and commands and use it when necessary.
I have two Syno NAS -- one for my business -- one for personal. Have business internet with 5 IP addresses. Two routers on different IPs for domain ID purposes so they really are separate networks. Just had my first power crash in 13 years. Rebuilding the business NAS now -- had backups fortunately.
To prevent this problem in the future I bought a UPS that could support both NAS -- but -- I didn't think about the fact they are on separate networks. Only one USB port for connection. So, while ONE NAS and the routers can be on the UPS, I don't think I can put the second on and use the DSM integrated UPS management.
I was thinking that perhaps I could have one of the NAS -- the one that won't be connected via DSM -- PING the other NAS (and a couple of other sites like google and facebook), periodically, and if they are down, to automatically shut down. If I pinged say every 8 minutes and had a 5 minute shut down on the primary, I should be able to run for say 20-30 mins and eventually the pings won't work and it will shut down. I asked ChatGPT to help me craft a script to put into the "remote" NAS Task Scheduler and it gave me the following: MY QUESTION: Does this look like it would work, AND, is there any danger to putting this script in? Any thoughts would be appreciated. Thanks in advance!
ChatGPT's script:
#!/bin/sh
SITES=("example1.com" "example2.com" "example3.com") # Replace with the domains you want to ping
PING_COUNT=1
PING_INTERVAL=15
TOTAL_DURATION=120
SLEEP_TIME=480 # 8 minutes in seconds
while true; do
end_time=$((SECONDS + TOTAL_DURATION))
all_unresponsive=true
while [ $SECONDS -lt $end_time ]; do
for SITE in "${SITES[@]}"; do
count=$(ping -c $PING_COUNT $SITE | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }')
if [ $count -ne 0 ]; then
all_unresponsive=false
break
fi
done
if ! $all_unresponsive; then
break
fi
sleep $PING_INTERVAL
done
It then says to make the script executable using this:
chmod +x /path/to/your/script.sh
Finally these are the chatGPT instructions:
- Schedule the Script:
- Use Synology’s Task Scheduler to run this script at startup or at regular intervals.
- Ping multiple specified domains every 15 seconds for a total of 2 minutes.
- If all domains are unresponsive during this period, it will shut down the NAS.
- The script will then wait for 8 minutes before running again.