Command Line Event Export

Forum for questions and support relating to the 1.30.x releases only.
Locked
Pedulla
Posts: 167
Joined: Thu Nov 27, 2014 11:16 am
Location: Portland, Or

Command Line Event Export

Post by Pedulla »

Hi All,
ZM 1.30.4, Ubuntu Server 14.04 LTS (204 days uptime :)
Event storage to FreeNAS via NFS. Accessed over very slow DSL.

I'm doing a continuous record on a PTZ camera on "patrol". (1920x1080x10fps)
When I go to export a given 10min event (event details, frame details, image files) the export popup just does the travelling export thing (Exporting.......) but export never completes and nothing downloads.

It's working as expected on a local ZM server (zm 1.30.4, Ubuntu Server 16.04.3 LTS, local storage.

There are a number of things that could be causing it to fail/not complete; storage differences, local net vs vpn over dsl, version of server OS.
So I thought I'd ask the guru's if there was a command line or series of steps I could do on the console of the ZM server to step through and export and see what's going on.

BTW, I don't want video, I prefer the individual frames for forensic use; good on you all for making video record optional; it has it's place, but you can't beat the individual frames for clarity!

Thanks
Pedulla
Posts: 167
Joined: Thu Nov 27, 2014 11:16 am
Location: Portland, Or

Re: Command Line Event Export

Post by Pedulla »

After reading my post, I thought I'd add some clarification... The DSL connection is a management connection, not the connection to the FreeNAS.

Is this one of those things where if I could read the code it would be obvious?

Thanks again
digital-gnome
Posts: 17
Joined: Mon Sep 04, 2017 12:47 am

Re: Command Line Event Export

Post by digital-gnome »

I just worked with the export code some. I know a little, certainly no guru.

The export window sends an ajax call that triggers /usr/share/zoneminder/www/skins/classic/includes/export_functions.php for the heavy lifting. For detail and image files it both generates some html to view later and packages up all the jpgs. I'd suspect either the storage path is breaking or it's actually timing out. I don't believe the ajax returns a timeout error. Check your apache error logs for php timeout.

When it's generating the archive it uses /tmp/zm/zmExport.zip or .tar.gz and /tmp/zm/zmFileList.txt
You might check that file list while it says it's generating the archive and see if the paths are sane.
rockedge
Posts: 1177
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: Command Line Event Export

Post by rockedge »

there are various small details that can cause this to happen. check the time on the mysql server and that it matches the machine time and php time...in sync so to say...the other cause is the permissions are not correct and/or the /var/cache/zoneminder/temp folder is missing.
digital-gnome
Posts: 17
Joined: Mon Sep 04, 2017 12:47 am

Re: Command Line Event Export

Post by digital-gnome »

Huh. 1.30.4 is different. rockedge is right /var/cache/zoneminder/temp is the correct directory, not /tmp/zm.
Pedulla
Posts: 167
Joined: Thu Nov 27, 2014 11:16 am
Location: Portland, Or

Re: Command Line Event Export

Post by Pedulla »

Thanks for the help. --Solved-- Further questions.

Checked the time, we're good there.

Ya, it was the temp directory. I went the lazy route and only made one mount point to the NFS store at ...../zoneminder
I didn't re-make the temp directory :oops:

Recreated the /var/cache/zoneminder/temp and applied www-data:www-data ownership and bam export starts creating .gz file as expected.

So the question is (because this where I don't know all the pieces to the puzzle) can I run the php script from the command line and pipe the out put to some kind of curl, or http get type command, to handle the auto http download that starts?

What would that php command line look like?
and/or
Is there a parameter that can be passed to the export script to not start the http download?
(Then I'd just pull the file from the temp directory)
digital-gnome
Posts: 17
Joined: Mon Sep 04, 2017 12:47 am

Re: Command Line Event Export

Post by digital-gnome »

In /usr/share/zoneminder/www/skins/classic/views/js/export.js you could comment out the line at the end of the file that says

Code: Select all

  if ( exportReady ) {
    startDownload.pass( exportFile ).delay( 1500 );
  }

Code: Select all

  if ( exportReady ) {
//    startDownload.pass( exportFile ).delay( 1500 );
  }
You can still click on the download link if you need to. As far as I can see it doesn't break anything. Future updates would revert this of course.
rockedge
Posts: 1177
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: Command Line Event Export

Post by rockedge »

remember the directory structure looks like :
/var/cache/zoneminder
/var/cache/zoneminder/events
/var/cache/zoneminder/images
/var/cache/zoneminder/temp

the code modification digital-gnome has shown seems to be the most solid simple solution.
Pedulla
Posts: 167
Joined: Thu Nov 27, 2014 11:16 am
Location: Portland, Or

Re: Command Line Event Export

Post by Pedulla »

Testing on a smaller event.
With the code commented, apache2 restarted, zoneminder restarted, the download still starts.

sudo nano /usr/share/zoneminder/www/skins/classic/views/js/export.js

Code: Select all

function initPage()
{
    configureExportButton( $('exportButton') );
    if ( exportReady )
    {
//        startDownload.pass( exportFile ).delay( 1500 );
    }
}
Any thoughts?
Locked