I am creating a batch script to run php-cgi, mariadb and nginx in the background when Windows launches.
Here is my script:
@echo off
set mariadb_home=C:wamp64binmariadbmariadb10.6.5bin
set php_home=C:php8.1.10
set nginx_home=C:nginx-1.27.0nginx-1.27.0
if not exist "%mariadb_home%" (
echo The specified MARIADB directory does not exist: %mariadb_home%
exit /b 1
)
if not exist "%php_home%" (
echo The specified PHP directory does not exist: %php_home%
exit /b 1
)
if not exist "%nginx_home%" (
echo The specified NGINX directory does not exist: %nginx_home%
exit /b 1
)
rem run php-cgi in background on port 9000
cd /d %php_home%
start /b "" "php-cgi" -b 127.0.0.1:9000
rem run mariadb in background
cd /d %mariadb_home%
start /b "" "mysqld"
rem run nginx in background
cd /d %nginx_home%
start "" "nginx"
if errorlevel 1 (
echo Failed to start services
exit /b 1
)
exit /b 0
Currently only two services out of three are in the background (php-cgi and nginx), but for mariadb I have a window with: “2024-06-04 13:47:19 0 [Note] mysqld (server 10.6.5- MariaDB) starting as process 15096…”.
How can I make MariaDb running in background ? The flag b seems not working as well.
3