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.......
Copy Zoneminder Files From Events Directory
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"
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
I put the script in 'vim' and cleaned up the formatting, then put it back in a set of Code tags for you.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:Thanks for your time and response.......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
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: Select all
mv $i /home/user1/Axis1$fname
Code: Select all
cp $i /home/user1/Axis1$fname
Code: Select all
for i in `find /usr/share/zoneminder/events/1/ -name *ana*.jpg`
do
rm $i
echo $i removed
done
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.