Page 1 of 1
Copy Zoneminder Files From Events Directory
Posted: Mon Jan 16, 2012 5:44 pm
by rharjika
What we want to do is copy the zoneminder jpg files from events directory and its subdirectories to another location what is the best way to achieve this. We have written customized linux scripts to do so but when we execute them in a loop after a while zoneminder stops responding or rather stops storing images in its directory. Following is the copy code we are executing:
#!/bin/bash
j=0
while [ 1 ]
do
echo Process > /home/user1/runprocess.out
for i in `find /usr/share/zoneminder/events/1/ -name *ana*.jpg`
do
rm $i
echo $i removed
done
for i in `find /usr/share/zoneminder/events/1/ -name *c*.jpg`
do
fname=`basename $i`
echo $fname
mv $i /home/user1/Axis1$fname
echo $i Copied
done
done
Thanks for your time and response.......
Re: Copy Zoneminder Files From Events Directory
Posted: Fri Jan 20, 2012 10:26 pm
by alf
Remove the loops and use a cron script?
crontab - e
something like
* 1 * * * * cp /some/directory/*jpg* /some/other/directory
1 1 * * * * echo "somethiongs done"
* 2 * * * * cp /some/directory/*jpg* /some/other/directory
1 2 * * * * echo "somethiongs done"
Re: Copy Zoneminder Files From Events Directory
Posted: Sat Jan 21, 2012 5:17 pm
by eracc
rharjika wrote:What we want to do is copy the zoneminder jpg files from events directory and its subdirectories to another location what is the best way to achieve this. We have written customized linux scripts to do so but when we execute them in a loop after a while zoneminder stops responding or rather stops storing images in its directory. Following is the copy code we are executing:
Code: Select all
#!/bin/bash
j=0
while [ 1 ]
do
echo Process > /home/user1/runprocess.out
for i in `find /usr/share/zoneminder/events/1/ -name *ana*.jpg`
do
rm $i
echo $i removed
done
for i in `find /usr/share/zoneminder/events/1/ -name *c*.jpg`
do
fname=`basename $i`
echo $fname
mv $i /home/user1/Axis1$fname
echo $i Copied
done
done
Thanks for your time and response.......
I put the script in 'vim' and cleaned up the formatting, then put it back in a set of Code tags for you.
You are not
copying files, you are
moving files. Plus you appear to be doing this
outside of ZM, which I would expect to break things in ZM. If you want to
copy then you should replace this line ...
... with this line:
I would also completely
remove this section:
Code: Select all
for i in `find /usr/share/zoneminder/events/1/ -name *ana*.jpg`
do
rm $i
echo $i removed
done
Then set up a filter or filters inside ZM to manage removal of events and files.
All that said, why exactly are you moving the files at this point? Perhaps we can help you come up with a way to do what you want that does not break ZM.