Delay starting Unifi Video (NVR) until it’s recording partition has been mounted.


Unifi Video installed on Debian is setup to record to a remote filesystem.


The unifi-video service is started before the remote filesystem is mounted. unifi-video fails silently after the remote filesystem has mounted in that it neither keep recordings nor does it notify the user that it is failing to persist recordings.


Delay the start of the unifi-video service until after the remote filesystem has been mounted.

To do so, make note of the remote filesystem to which you wish to save recordings, then modify unifi-video’s init script and make it wait until that filesystem has been mounted.


By /etc/fstab, I’m mounting /video by NFS. /video nfs rw,async,hard,intr,noexec,_netdev 0 0

The following command returns 0 if the above has been mounted; 1 otherwise.

grep " /video nfs4" /proc/mounts

As such, unifi-video’s init script can be modified to start only if the aforementioned test passes.

The script is at /etc/init.d/unifi-video

Add the following after start) while keeping the same indention level as the following code (in that file).

while ! grep " /video nfs4" /proc/mounts
    sleep 1
    count=`expr $count + 1`
    if test $count -eq 30
        log_failure_msg "(the remote datastore is not mounted)"
        exit 1

Then execute the following to reload the init script.

systemctl daemon-reload

At this point it is a good idea to reboot the server, then execute the following to ensure unifi-video is able to start.

service status unifi-video

Configuring a Debian 9 v.m. to perform unattended upgrades.

Debian’s wiki contains an general guide for unattended upgrades.
(PDF Archive: UnattendedUpgrades – Debian Wiki)

Uncomment the following lines in /etc/apt/apt.conf.d/50unattended-upgrades

Unattended-Upgrade::Mail "root";
Unattended-Upgrade::MailOnlyOnErrors "true";
Unattended-Upgrade::Remove-Unused-Dependencies "true";
Unattended-Upgrade::Automatic-Reboot "true";
Unattended-Upgrade::Automatic-Reboot-WithUsers "false";

Passwordless SSH

Tired of having to retype your password each time you login to that remote computer?
Let me show you how to setup passwordless ssh.
Generate public and private keys on your client computer. Leave the passphrase empty.

user@local:~$ ssh-keygen -t rsa

Distribute your public key (~/.ssh/ to each servers .ssh/authorized_keys file.
user@local:~$ cat ~/.ssh/ | ssh user@servername 'tee -a .ssh/authorized_keys'
Security concerns: If someone gets hold of your private key AND your left the passphrase empty, the he will have access to all of the remote computers just as you.

[ad#Google Adsense-1]