I run a QNAP TS-459 Pro+ as my homelab NAS, connected to several Linux machines across different distros. Fedora 44, NixOS, Solus, whatever. The problem: I had to remember different commands to check disk status, restart NFS, fix permissions, manage keepalive scripts, diagnose remote access issues.

Instead of hunting through notes or SSH-ing and fumbling around, I wanted one tool. A menu. Same commands, same approach, any distro. Works local or remote. I can call it from my home bin folder and it just works.

the why

SSH into QNAP repeatedly is slow. Copy-pasting commands is error prone. Documentation spreads across five different places. Every time I boot a fresh distro install, I end up spending 30 minutes remembering how to mount shares or restart NFS.

A menu-driven tool means I never have to remember the commands. Press 2, check status. Press 16, check disk SMART health. Press 18, restart keepalive. The tool handles the details.

Also, it detects network location automatically. If you are on the local network, it connects directly to 192.168.0.xxx. If you are remote, it uses the myqnapcloud hostname. No manual switching.

the tool

The script does three main things:

  1. Detects if you are local or remote
  2. Shows a menu with 19 operations
  3. Runs the operation via SSH or direct commands

Main operations:

  • SSH access
  • Status and health checks (memory, uptime, load)
  • NFS management (list shares, restart service, fix permissions)
  • Disk checks (usage, SMART data, load cycle counts)
  • Remote access diagnosis (DNS resolution, port checks, connectivity tests)
  • Setup tools (mount configuration, SSH keys, initial config)
  • Optimization (memory cleaning, network buffer tweaks)
  • Maintenance (keepalive process monitoring, disk head parking prevention)

how to use it

Get the script into your home bin folder:

mkdir -p ~/bin
curl https://raw.githubusercontent.com/tolgaerok/qnap-manager/main/qnap-manager -o ~/bin/qnap-manager
chmod +x ~/bin/qnap-manager

Add ~/bin to your PATH if it is not already there. In your bashrc:

export PATH="$HOME/bin:$PATH"

Then source it:

source ~/.bashrc

Now just run:

qnap-manager

It shows a menu. Press the number for what you want.

inside the script

The script has a config section at the top:

qnap_host="jacksparrow.myxxxxd.com"
qnap_user="xxxx"
qnap_ip="192.168.0.xxx"

Change these to match your QNAP. The IP gets masked in public posts but use your real local IP.

The check_network function pings your local IP. If it responds, you are local. If not, it switches to the remote hostname.

check_network() {
    if ping -c 1 -W 1 $qnap_ip &>/dev/null; then
        echo "local"
    else
        echo "remote"
    fi
}

Every SSH operation calls this first. So everything automatically switches between local direct connection and remote access. No manual changes needed.

key operations explained

status check

Shows uptime, kernel version, load average, memory usage. Quick health snapshot:

2) check qnap status

disk smart health

Pulls SMART data from all four disks. Shows runtime hours, load cycles, temperature, and critical values like reallocated sectors.

16) check smart health

This is useful because older drives (my disks 3 and 4 are about 7 years in) need monitoring. The script baseline compares against known values and shows you what changed.

keepalive status

My WD Red drives on disks 3 and 4 have an aggressive head parking feature. Without regular disk access, they park every 8 minutes. That breaks NFS performance and kills the drives faster via constant parking cycles.

Keepalive touches the disks every 30 minutes to prevent that. Option 17 checks if it is running, looks at the log, and compares current load cycle counts against baseline:

17) disk keepalive status

If keepalive stopped, option 18 restarts it and rewrites the autorun.sh script:

18) fix keepalive

setup tools

Option 11 installs NFS, LFTP, SSH tools and configures mount points. Option 12 sets up passwordless SSH keys. Option 13 diagnoses why remote access might be failing.

These are one-time setup commands. Run them once on a fresh system and everything is configured.

network tweaks

Option 19 applies buffer tuning to the QNAP kernel:

19) fix network tweaks

After firmware updates, these settings get reset. Run this to reapply them and persist to sysctl.conf.

why this design

Simple reasons:

  1. You do not have to remember shell one-liners
  2. It works on any distro because it is pure bash
  3. It works on any machine because it SSH-es to QNAP
  4. Auto-detection of local vs remote removes manual switching
  5. All output goes through the same tool, same colors, same format
  6. One place to edit when QNAP IP changes or credentials update

For me, it is faster to press 16 than to SSH in, run get_hd_smartinfo, pipe through grep, format the output. The tool does that every time consistently.

the approach

I built this because troubleshooting always followed the same pattern:

  • SSH to QNAP
  • Run some command
  • Check the output
  • Maybe run a second command
  • Check again

Instead of documenting each step separately, I wrapped them into a menu. Each option is a small function that does one job well. The script runs SSH once and pipes all the commands together in the right order.

This is why I like menu-driven tools for homelab stuff. You end up using them more often because there is zero friction. Just run it, pick an option, get the answer.

masking and editing

The script has your real IP and hostname at the top. Mask them for public posts:

qnap_host="hostname.myqxxxxx.com"
qnap_user="xxxx""
qnap_ip="192.168.x.xxx"

If you are sharing this publicly, mask the last octet. Keep the structure but hide the actual IP.

For your own use, fill in the real values and commit it to your private repo or keep it locally.