View unanswered posts | View active topics It is currently Thu Jun 20, 2013 8:54 am



Reply to topic  [ 3 posts ] 
Copy Zoneminder Files From Events Directory 
Author Message

Joined: Tue Nov 22, 2011 6:14 pm
Posts: 7
Post Copy Zoneminder Files From Events Directory
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.......


Mon Jan 16, 2012 6:44 pm
Profile

Joined: Wed Jun 17, 2009 7:13 pm
Posts: 39
Post Re: Copy Zoneminder Files From Events Directory
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"


Fri Jan 20, 2012 11:26 pm
Profile
User avatar

Joined: Wed Mar 08, 2006 4:26 pm
Posts: 79
Location: Tennessee, USA
Post Re: Copy Zoneminder Files From Events Directory
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:
#!/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 ...
Code:
mv $i /home/user1/Axis1$fname

... with this line:
Code:
cp $i /home/user1/Axis1$fname

I would also completely remove this section:
Code:
        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. :)

_________________
ERA Computers & Consulting
Security Cameras and Systems


Sat Jan 21, 2012 6:17 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: Majestic-12 [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group