lsb_release -a; # tested under
Description: Debian GNU/Linux 10 (buster)

su - root
# create new file
touch /scripts/shutdown.sh
chmod +x /scripts/shutdown.sh

# edit and insert orange content
vim /scripts/shutdown.sh 
#!/bin/bash
echo "=== shutdown as gracefully as possible ==="

# stop all vms
# /scripts/vboxmanage/stop.sh 

echo "... sending shutdown signal to nas"
ssh -v -p22 admin@192.168.2.230 'halt'

echo "... sync harddisks"
sync; sync; sync;

echo "... unmount mounts"
# this is where also nfs mounts should be
umount /media/user/*

echo "... shutting down system"
shutdown -h now;


# testedrive
/scripts/shutdown.sh
# it should ask for password for NAS
# after that there should be a beep from the NAS indicating it will shutdown
# (takes a long time to shutdown ~10min) hurray it works! :)
admin