From ce533087bb7dcc4b26c936fe5b5c64be10b1bb1b Mon Sep 17 00:00:00 2001 From: stan Date: Mon, 20 Jan 2003 22:25:19 +0000 Subject: [PATCH] Get fresh status for each command and change to the right directory first. git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@363 e3e1d417-86f3-4887-817a-d78f3d33393f --- scripts/zmpkg.pl.z | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/zmpkg.pl.z b/scripts/zmpkg.pl.z index cbfb2a3e9..a9fed5c4f 100755 --- a/scripts/zmpkg.pl.z +++ b/scripts/zmpkg.pl.z @@ -80,6 +80,9 @@ sub execute return( qx( $command ) ); } +# Move to the right place +chdir( ZM_PATH_WEB ) or die( "Can't chdir to '".ZM_PATH_WEB."': $!" ); + my $log_file = LOG_FILE; open( LOG, ">>$log_file" ) or die( "Can't open log file: $!" ); #open( STDOUT, ">&LOG" ) || die( "Can't dup stdout: $!" ); @@ -95,12 +98,12 @@ if ( $> != $web_uid ) chown( $web_uid, $web_gid, $log_file ) or die( "Can't change permissions on log file: $!" ) } -my $status = execute( ZM_PATH_BIN."/zmdc.pl check" ); my $retval = 0; -chomp( $status ); if ( $command =~ /^(?:stop|restart)$/ ) { + my $status = execute( ZM_PATH_BIN."/zmdc.pl check" ); + chomp( $status ); if ( $status eq "running" ) { execute( ZM_PATH_BIN."/zmdc.pl shutdown" ); @@ -113,6 +116,8 @@ if ( $command =~ /^(?:stop|restart)$/ ) if ( $command =~ /^(?:start|restart)$/ ) { + my $status = execute( ZM_PATH_BIN."/zmdc.pl check" ); + chomp( $status ); if ( $status eq "stopped" ) { execute( ZM_PATH_BIN."/zmfix" ); @@ -155,6 +160,8 @@ if ( $command =~ /^(?:start|restart)$/ ) if ( $command eq "status" ) { + my $status = execute( ZM_PATH_BIN."/zmdc.pl check" ); + chomp( $status ); print( STDOUT $status."\n" ); }