1.28.1 - 'zmupdate.pl -c' exited abnormally, exit status 9

Forum for questions and support relating to the 1.28.x releases only.
Locked
freak
Posts: 112
Joined: Wed May 03, 2006 5:22 pm

1.28.1 - 'zmupdate.pl -c' exited abnormally, exit status 9

Post by freak »

Using 1.28.1 I get an occaisonal "'zmupdate.pl -c' exited abnormally, exit status 9" in my logs. Nothing seems to be wrong but I'm not really sure. Can anyone enlighten me as to what this error means and what might be causing it?
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: 1.28.1 - 'zmupdate.pl -c' exited abnormally, exit status

Post by knight-of-ni »

Most zoneminder commands can be manually executed from the commadline, and that often reveals helpful information.
Here is the usage text from zmupdate:
[abauer@localhost ~]$ sudo zmupdate.pl --h
Unknown option: h

Usage: zmupdate.pl <-c,--check|-f,--freshen|-v<version>,--version=<version>> [-u<dbuser> -p<dbpass>]>
Parameters are :-
-c, --check - Check for updated versions of ZoneMinder
-f, --freshen - Freshen the configuration in the database. Equivalent of old zmconfig.pl -noi
-v<version>, --version=<version> - Force upgrade to the current version from <version>
-u<dbuser>, --user=<dbuser> - Alternate DB user with privileges to alter DB
-p<dbpass>, --pass=<dbpass> - Password of alternate DB user with privileges to alter DB
-d<dir>,--dir=<dir> - Directory containing update files if not in default build location
-interactive - interact with the user
-nointeractive - do not interact with the user
You can see that "-c" is the parameter for checking the Internets for a newer version of zoneminder.

If you are curious, the site zoneminder checks is shown in the code here:
https://github.com/ZoneMinder/ZoneMinde ... pl.in#L156

which tries to http GET:
http://zoneminder.github.io/ZoneMinder/version.txt

The error you are receiving means that the GET command failed. Make sure you are connected to the Internet at the time of the error and your DNS is working (you can check this by typing "nslookup zoneminder.github.io"). Sometimes github goes into maintenance mode and that would cause the problem as well if the site is temporarily down. I've run into that a couple of times.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
freak
Posts: 112
Joined: Wed May 03, 2006 5:22 pm

Re: 1.28.1 - 'zmupdate.pl -c' exited abnormally, exit status

Post by freak »

Not a perl expert but how do we ever get out of this this while loop?

Code: Select all

while( 1 ){
  my $now = time();
  if ( !$lastVersion || !$lastCheck || (($now-$lastCheck) > CHECK_INTERVAL) )  {
    Info( "Checking for updates\n" );
    use LWP::UserAgent;
    my $ua = LWP::UserAgent->new;
    $ua->agent( "ZoneMinder Update Agent/".ZM_VERSION );
    if ( $Config{ZM_UPDATE_CHECK_PROXY} ) {
      $ua->proxy( "http", $Config{ZM_UPDATE_CHECK_PROXY} );
    }
    my $req = HTTP::Request->new( GET=>'http://zoneminder.github.io/ZoneMinder/version.txt' );
    my $res = $ua->request($req);
    if ( $res->is_success )  {
      $lastVersion = $res->content;
      chomp($lastVersion);
      $lastCheck = $now;
      Info( "Got version: '".$lastVersion."'\n" );
      my $lv_sql = "update Config set Value = ? where Name = 'ZM_DYN_LAST_VERSION'";
      my $lv_sth = $dbh->prepare_cached( $lv_sql ) or die( "Can't prepare '$lv_sql': ".$dbh->errstr() );
      my $lv_res = $lv_sth->execute( $lastVersion ) or die( "Can't execute: ".$lv_sth->errstr() );
      my $lc_sql = "update Config set Value = ? where Name = 'ZM_DYN_LAST_CHECK'";
      my $lc_sth = $dbh->prepare_cached( $lc_sql ) or die( "Can't prepare '$lc_sql': ".$dbh->errstr() );
      my $lc_res = $lc_sth->execute( $lastCheck ) or die( "Can't execute: ".$lc_sth->errstr() );
    }
    else {
      Error( "Error check failed: '".$res->status_line()."'\n" );
    }
  }
sleep( 3600 );
}
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: 1.28.1 - 'zmupdate.pl -c' exited abnormally, exit status

Post by knight-of-ni »

You don't.
zmupdate checks for a new version every 3600 seconds (apparantly) until zoneminder is stopped.

While I'm sure being notified of new versions of zoneminder is helpful to some, I usually turn it off under Options.
If you are using a packaged version of zoneminder, you should turn it off, as it is up to the package maintainer to provide new releases of zonemider to you, rather than the zoneminder.com site.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
freak
Posts: 112
Joined: Wed May 03, 2006 5:22 pm

Re: 1.28.1 - 'zmupdate.pl -c' exited abnormally, exit status

Post by freak »

Is there a process monitoring zmupdate.pl and restarting it if it dies? If so why not just run the zmupdate periodically versus checking to see if it dies?
freak
Posts: 112
Joined: Wed May 03, 2006 5:22 pm

Re: 1.28.1 - 'zmupdate.pl -c' exited abnormally, exit status

Post by freak »

What made me think the loop was meant to exit was the "Update agent exiting" line of code below. I don't see how it could ever be executed.

Code: Select all

if ( $check && $Config{ZM_CHECK_FOR_UPDATES} ) {
  print( "Update agent starting at ".strftime( '%y/%m/%d %H:%M:%S', localtime() )."\n" );
  while (1) {
    ...
  }
  print( "Update agent exiting at ".strftime( '%y/%m/%d %H:%M:%S', localtime() )."\n" );
}
Locked