1. Current Location: Home >  NAS >  Create an N100 Flying Bull NAS "true uninterruptible power supply": old notebook battery resurrection record, power off 0 seconds switching, incoming call network wake-up, and comes with an automatic shutdown script

Create an N100 Flying Bull NAS "true uninterruptible power supply": old notebook battery resurrection record, power off 0 seconds switching, incoming call network wake-up, and comes with an automatic shutdown script

1. Write in front

Feiniu NAS (N100 small host + Feiniu OS) has low power consumption and strong performance, but the price of UPS that supports USB protocol is generally high, and the USB companion of NAS is also dozens of larger (even more so if there is a UPS, it is directly 0 cost you can achieve automatic shutdown, see the fourth step). In order to data security , I disassembled the dusty notebook battery in the drawer and spent less than a few tens of yuan to assemble a set of " beggar's version UPS", which can not only switch in 0 seconds, but also automatically shut down safely after a power outage, and wake up the network with one click on the main route + NAS after the call.

2. Bill of materials

Waste Notebook Lithium Battery (6 Cells)

Fully automatic 12V battery management board with UPS mode

12V Boost and Voltage Regulator Module

N100 small host (flashed Feiniu OS)

main route is iExpress (also connected to UPS)

secondary routing (bedroom relay)

DC5521 male/female, wire

Note: The keyword of the management board model is "12V UPS lithium battery protection board automatic charging and discharging uninterrupted", be sure to buy one with "UPS mode", switch for 0 seconds without dropping voltage.

3. Quick overview of principles

power supply path
mains → 12V UPS board→ regulated voltage 12V →N100NAS, main router, optical cat
After the mains power is lost, the UPS board cuts to the lithium battery in 0 seconds to continue output, and the voltage regulation module regulates 12V to the NAS, main router, and optical cat.

network wake-up link
Guangmao and the main route Aikuai are also connected to the same UPS, and they are still online after the power is cut off. After the NAS is turned off, you can → "Wake on to Network" in the iKuai app at any time.

automatic shutdown trigger
Feiniu OS has built-in Crontab+Shell, ping the sub-route every 3 seconds IP: 192.168.9.5 (this is my sub-router address, changed to your own address in the later code)
10 consecutive times of failure to connect will determine "mains power is cut off + sub-route is hung", and the shutdown is performed (the time and number can be modified according to your own needs).
secondary route is not connected to the UPS, and the power is cut off before the NAS after the mains power is cut off, naturally forming a "power loss signal".

4. Feiniu OS automatic shutdown script

log in to the NAS with WinSCP and create /usr/ups_safe_shutdown.sh:

#!/bin/bash # ============================================================================ # Automatic shutdown guard script for network loss (fixed router IP version) # Must run as root # Count Nest Notes # ============================================================================ # ---------- 1. Permission Check ---------- if [[ $EUID -ne 0 ]]; then echo "Error: This script must run with root privileges." >&2 exit 1 fi # ---------- 2. Singleton Lock ---------- LOCKFILE="/var/run/ups_safe_shutdown.pid" exec 200>"$LOCKFILE" if ! flock -n 200; then echo "The script is running, exit." exit 1 fi echo $$ >&200 # ---------- 3. Basic configuration ---------- ROUTER_IP="192.168.9.5" # Fixed router address (unchanged) MAX_FAIL=10 # Maximum number of consecutive failures CHECK_INT=3 # Detection interval (seconds) LOG_FILE="/usr/ups_safe_shutdown.log" failure_count=0 # Log function log() { echo "$(date '+%F %T') - $*" | tee -a "$LOG_FILE" } # ---------- 4. Main Cycle ---------- while :; do if ping -c1 -W1 "$ROUTER_IP" >/dev/null 2>&1; then # Network recovery if [[ $failure_count -ge $MAX_FAIL ]]; then # Shutdown was triggered before, now canceled shutdown -c 2>/dev/null &> log "Network restored, cancel shutdown schedule" fi failure_count=0 else # Network failure ((failure_count++)) log "Ping Failures: $failure_count/$MAX_FAIL" if [[ $failure_count -eq $MAX_FAIL ]]; then log "$MAX_FAIL pings fail in a row, the system will shut down after 60 seconds!" shutdown -h +1 "System triggers automatic shutdown due to loss of network connection" fi fi sleep "$CHECK_INT" done

1. Grant Execution Permissions:

chmod +x /usr/ups_safe_shutdown.sh

2. Create a systemd service unit:

sudo tee /etc/systemd/system/ups_safe_shutdown.service >/dev/null < <'EOF' [Unit] Description=Network Watchdog – auto-shutdown on lost router After=network-online.target Wants=network-online.target [Service] Type=simple ExecStart=/usr/ups_safe_shutdown.sh Restart=always RestartSec=10 KillMode=process # Send the log to journal for easy systemctl status viewing StandardOutput=journal StandardError=journal [Install] WantedBy=multi-user.target EOF

3. Enable and start immediately:

sudo systemctl daemon-reload sudo systemctl enable --now ups_safe_shutdown.service

4. Common Administrative Commands:

check the operating status
sudo systemctl status ups_safe_shutdown.service__TAG76_TAG77__ real-time log (journal)
sudo journalctl -u ups_safe_ shutdown - f
manually restart
sudo systemctl restart ups_safe_shutdown
stop
sudo systemctl stop ups_safe_shutdown

5. Verification steps

unplug the mains power, observe that the NAS panel light is still on, and the route can still be pinged → UPS switch successfully.

unplug the secondary route and wait for a while NAS automatically shut down → the script takes effect.

power up again, log in to the "Wake-on" app → select the NAS →, and after 5 seconds, the N100 drop starts → wakes up successfully.

6. Guide to pit drainage

is a fast router, so don't turn on hijacking all PING values.

7. Conclusion

whole solution makes use of the waste laptop battery, so you don't have to spend too much money to buy a UPS, and you don't have to worry about the hard drive being damaged during a power outage.
I wish you all a happy time and the data will last forever!

Read More


Copyright Notice Scan to read on mobile
All Rights Reserved: 《SHUNOT》 => 《Create an N100 Flying Bull NAS "true uninterruptible power supply": old notebook battery resurrection record, power off 0 seconds switching, incoming call network wake-up, and comes with an automatic shutdown script
Article URL: https://www.shunot.com/en/nas/660.html
Unless otherwise stated, all articles are original by 《SHUNOT》. Reposting is welcome! Please indicate the original URL when reposting, thank you.

Comment List

One page book
One page bookReply
#48
Use old batteries and simple modules to build a UPS, low cost and practical, automatic shutdown when power is off, wake up for incoming calls, true black technology, data security is guaranteed, and you can save electricity bills, it's too smart!
1 个月前
There is a road i...
There is a road i...Reply
#47
Using old batteries and simple accessories to build a UPS, low cost and practical, 0 seconds of power off is too reassuring, automatic shutdown and network wake-up functions are also very intimate, data security is guaranteed, it is really a smart DIY solution.
1 个月前
Broken Bridge Yiren
Broken Bridge YirenReply
#46
This solution is very cost-effective, using old batteries and simple devices to achieve uninterrupted power supply of the NAS, as well as network wake-up and automatic shutdown, which is very practical and suitable for users with limited budgets but looking for stability.
1 个月前
Movie buffs
Movie buffsReply
#45
Use old batteries and simple hardware to build a UPS, low cost and good effect, true uninterruptible power supply is well deserved, power off 0 seconds switching is too stable, data security is guaranteed, it is worth a try.
1 个月前
Xiao Ming
Xiao MingReply
#44
This solution is very practical, using old batteries and simple modules to realize the UPS function, which not only saves money but is also very reliable, and the power off 0-second switching and wake-up function are very helpful to the stable operation of the NAS.
1 个月前
The misty rain is...
The misty rain is...Reply
#43
Make your own UPS with old batteries and simple accessories, low cost and good effect, NAS and router can be safely shut down when the power is off, and incoming calls will be automatically woken up, practical and environmentally friendly, which is really a good way to save money and worry.
2 个月前
Coffee time
Coffee timeReply
#42
This solution is quite creative, using old batteries and simple devices to achieve UPS functions, low cost and practical, especially the power off 0-second switching and network wake-up function, which can indeed ensure data security and is worth trying.
2 个月前
Code poets
Code poetsReply
#41
This solution is quite practical, using old batteries and simple modules to achieve uninterrupted power supply of NAS, and can also remotely wake up and automatically shut down, saving a lot of money, data security is guaranteed, worth trying.
2 个月前
A shallow smile i...
A shallow smile i...Reply
#40
This solution is too smart, using old batteries and simple accessories to achieve uninterrupted power supply and automatic shutdown of the NAS, which is both cost-saving and practical, data security is guaranteed, and it also supports network wake-up, which is really a good way to kill multiple birds with one stone!
2 个月前
Traveling to the ...
Traveling to the ...Reply
#39
Using old batteries and simple modules to build a UPS, the cost is low and the effect is good, and the power off 0 seconds switching also supports automatic shutdown and network wake-up, which is really a smart solution to make the most of it.
2 个月前
Dreamer
DreamerReply
#38
This solution is low-cost and practical, using old batteries and simple modules to achieve uninterrupted power supply and automatic shutdown of the NAS, and network security is not affected, which is really a smart DIY method.
2 个月前
Poetry and distance
Poetry and distanceReply
#37
Using old batteries to DIY UPS is really cost-effective, solving the problem of power failure, and can also automatically shut down and wake up, the details are handled very well and practical.
2 个月前
Dead leaf butterfly
Dead leaf butterflyReply
#36
This scheme is so creative! Using old batteries and simple modules to realize UPS functions, low cost and practical, power off 0 seconds switching and automatic shutdown design is very intimate, data security is guaranteed, it is really a good example of waste utilization.
2 个月前
Time machine
Time machineReply
#35
Building a UPS with old batteries and simple modules not only saves money but also improves data security, which is a smart move. Although the operation requires certain skills, the effect is remarkable, and it is recommended for NAS users with similar needs.
2 个月前
The sword is dusty
The sword is dustyReply
#34
This solution is really useful, using old batteries and simple accessories to achieve uninterrupted power supply of NAS, and can also automatically shut down and wake up the network, saving a lot of money, data security and guarantee, worth trying.
2 个月前

Contact Us

Online Consultation: Click here to send me a message

WeChat ID: master_135

Scan to follow