first step
https://wiki.zoneminder.com/Ubuntu_Server_14.04_64-bit_with_Zoneminder_1.29.0_the_easy_way
second, moving the recording partition
https://wiki.zoneminder.com/Using_a_dedicated_Hard_Drive
third
see how the ip camera setting with zoneminder
fourth, set the filter for automatic deletion
http://zoneminder.readthedocs.org/en/latest/faq.html
fifth, set the timer when to record and stop
using crontab