WND Listener Configuration

We recently setup the new SMB notifications feature available with the Enterprise edition of 9.1, so we thought we would share our experiences for others.

First, you'll need to setup a listener for each of your shares.

Second, in a high availability environment, setup only one listener per share. Consequently, there is no redundancy for the listener(s).

Third, your credentials will be in plain text, which is gross but currently unavoidable.

Finally, we created a systemd script for CentOS 7. It should work on any systemd distro, provided you change the paths/users accordingly.

Steps
* Create a owncloud-listener.service file in /etc/systemd/system/ using your favorite text editor.
* Copy the contents from below into the file.
* Make sure the file is owned by root and has permissions 644.
* Type:

systemctl enable owncloud-listener.service

(or whatever you have named your file in step 1).

  • Control your new service like any other, e.g.:

 systemctl start owncloud-listener
  • This script is configured to autostart on boot.
  • Need multiple listeners? Just change the name of the file you create in step 1 and configure the ExecStart parameters accordingly.

Systemd script

[Unit]
Description=ownCloud WND Listener
After=syslog.target network.target
Requires=httpd.service
[Service]
User=apache
Group=apache
WorkingDirectory=/var/www/html/owncloud
ExecStart=/usr/bin/php /var/www/html/owncloud/occ wnd:listen SERVER SHARE USER PASSWORD
Type=simple
StandardOutput=journal
StandardError=journal
SyslogIdentifier=%n
KillMode=process
RestartSec=1
Restart=on-failure
[Install]
WantedBy=multi-user.target
2 Likes

Great share, thanks.

To derive improvements from your feedback, would you agree on this?

  • have all share configs in a file or DB, with crypted password
  • have a occ command to add / remove share configs
  • listener should merge notifications in a queue (e.g. Redis) to support HA setup and debounce repeated notifications.

Yes, that would be great.
It might make sense to just add this to the external storage configuration commands/GUI.

Yes, this would be nice, but failover/heartbeat would be sufficient too. That is, an active/passive setup for the listener.