Overview
This is my configuration:
Server OS: Ubuntu Server 14.04
ZoneMinder:1.28.1
Mounting box.com to local location
This is how you can mount a box.com directory manually: sudo mount -t davfs https://dav.box.com/dav /home/sergi/box.com
However it is better to do this via fstab. Information how to mount box.com locally is here. This will be mounted on startup.
If you do not want reboot run: sudo mount ~/box.com
Node installation
I am using node.js 5.x, however this should work with node.js 0.12.x and above. Installation information.
Fetching zmwatcher from GIT
Make sure you have installed git (sudo apt-get git)
CD to some location (in my case I used home directory)
Grab sources from github "git clone https://github.com/solvek/zmwatcher.git"
Running mirroring script
The mirroring script is located inside zmwatcher/samples/zmmirror/mirror.js
Open this file and add your config (basing on your hostname, hostname you can see at command prompt).
Before running the script you have to install it (its dependencies). Go to "cd ~/zmwatcher/samples/zmmirror"
Run "npm install" to install necessary dependencies
Run "sudo nodejs mirror.js" (in my case I am running it with root permissions because my regular user does not have permissions to events directory)
Modify samples/zmmirror/config.js with your values
To run script mirroring manually: sudo nodejs ~/zmwatcher/samples/zmmirror/mirror.js
Running mirroring script on linux startup
Using systemd
Create service file: sudo nano /etc/systemd/system/zmmirror.service
Copy my systemd script from here
Correct paths to node and index.js script
Save
Enable the service: sudo systemctl enable zmmirror.service
Start the servcie: sudo systemctl start zmmirror.service
Verify it is running: sudo systemctl status zmmirror.service
Using upstart system
A good description how to configure an upstart script.
Create starting service script: sudo nano /etc/init/zmmirror.conf
Copy my upstart script from here (another good script example)
Correct paths to node, zmmirror.js script, output log
Save
Check syntax sudo init-checkconf /etc/init/zmmirror.conf
Start service: sudo service zmmirror start
Check log: cat ~/zmmirror.log
That's all. This script should be started each time on system boot.
Useful commands:
Start service: sudo service zmmirror start
Stop service: sudo service zmmirror stop
Restart service: sudo service zmmirror restart
Deletion of old files
For deletion old content from box.com I am also using node.js script. The script is located here.
Here is how to schedule this script running once a day:
Edit cleanup script: sudo nano ~/zmwatcher/samples/zmmirror/cleanup.js
Specify your actual path.
Run cron: sudo crontab -e
Add line (run cleanup every day at 5 am): 0 5 * * * nodejs /home/sergi/zmwatcher/samples/zmmirror/cleanup.js
To run cleanup script manually: sudo nodejs ~/zmwatcher/samples/zmmirror/cleanup.js
"Real time mirroring new Zone Minder event to Box.net cloud"
No comments yet. -