diff --git a/Distro/tmp/after.php b/Distro/tmp/after.php index 39ffaeb8..dda3f30a 100644 --- a/Distro/tmp/after.php +++ b/Distro/tmp/after.php @@ -12,14 +12,17 @@ $CMD = `chown -R www-data:www-data /srv/www/module/lib/controller/data/uploads`; $CMD = `chmod -R 0775 /srv/www/module/lib/controller/data/reports`; - //Setup MediaMTX - - $CMD = `systemctl stop mediamtx.service`; // just to be sure - $CMD = `rm -f -R /opt/mediamtx`; - $CMD = `mv -f /srv/mediamtx /opt`; - $CMD = `mv -f /opt/mediamtx/mediamtx.service /etc/systemd/system/mediamtx.service`; + //MediaMTX is not installed any more: la_mojo serves the live view (WebRTC) and the recording itself. + //A mediamtx service left by an older package would hold the WebRTC port: stop and disable it. + $OUT = array(); + $RC = 1; + exec( 'systemctl list-unit-files --no-legend mediamtx.service 2>/dev/null', $OUT, $RC ); + if( ( $RC == 0 && count( $OUT ) > 0 ) || file_exists( '/etc/systemd/system/mediamtx.service' ) ){ + echo "MediaMTX service found: stopping and disabling it\n"; + $CMD = `systemctl stop mediamtx.service 2>&1`; + $CMD = `systemctl disable mediamtx.service 2>&1`; + }; $CMD = `systemctl daemon-reload`; - $CMD = `systemctl enable mediamtx.service`; $CMD = `systemctl enable argus_nginx`; //Restore Settings function restore_whole_line( $A, $B , $C ){