bat to shell

I have serverfiles of same game. and there are bat files. I wont to run this on debian.
The files are difficult, eg

:######################################################################## 
:# File name: server_start.bat
:# Edited Last By: Mike Gleaves (ric) 
:# V 1.0 1-10-2008
:# Comment: Run multi-Apache servers on same PC. Apache 2.2.9 core
:# modified by Novo (c)2010
:######################################################################## 

@echo off
color 3

rem ## Save return path
pushd %~dp0

rem ## Check to see if already stopped
if NOT exist AIONEmulator\usr\local\apache2\logs\httpd.pid goto :NOTSTARTED

rem ## It exists is it running
SET /P pid=<AIONEmulator\usr\local\apache2\logs\httpd.pid
netstat -anop tcp | FIND /I " %pid%" 2>nul
IF ERRORLEVEL 1 goto :NOTRUNNING
IF ERRORLEVEL 0 goto :RUNNING

:NOTRUNNING
rem ## Not shutdown using server_stop.bat hence delete file
del AIONEmulator\usr\local\apache2\logs\httpd.pid 2>nul
del AIONEmulator\usr\local\mysql\data\mysql.pid 2>nul

:NOTSTARTED
set pass1=found
set pass2=found
rem ## Check for another server on this Apache port
netstat -anp tcp | FIND /I "0.0.0.0:8096" 2>nul
IF ERRORLEVEL 1 set pass1=notfound

rem ## Check for another server on this MySQL port
netstat -anp tcp | FIND /I "0.0.0.0:3316" 2>nul
IF ERRORLEVEL 1 set pass2=notfound

if %pass1%==notfound if %pass2%==notfound goto NOTFOUND
echo.
echo  Both ports need to be free in order to run the servers
if %pass1%==notfound echo  Port 8096 is free - OK to run Apache server
if %pass1%==found echo  Another server is running on port 8096 cannot run Apache server
if %pass2%==notfound echo  Port 3316 is free - OK to run MySQL server
if %pass2%==found echo  Another server is running on port 3316 cannot run MySQL server
echo.
goto END

:NOTFOUND
echo  Port 8096 is free - OK to run server
echo  Port 3316 is free - OK to run server
rem ## Find first free drive letter
rem ## Find first free drive letter
for %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do CD %%a: 1>> nul 2>&1 & if errorlevel 1 set freedrive=%%a

rem ## Use batch file drive parameter if included else use freedrive
set Disk=%1
if "%Disk%"=="" set Disk=%freedrive%

rem ## To force a drive letter, remove "rem" and change drive leter
rem set Disk=w

rem ## Having decided which drive letter to use create the disk
subst %Disk%: "AIONEmulator"

rem ## Save drive letter to file. Used by stop bat 
(set /p dummy=%Disk%) >AIONEmulator\usr\local\apache2\logs\drive.txt <nul

rem ## Set variable paths
set apachepath=\usr\local\apache2\
set apacheit=%Disk%:%apachepath%bin\Apache_16.exe -f %apachepath%conf\httpd.conf -d %apachepath%.

rem ## Start Apache server
%Disk%:
start %Disk%:\home\admin\program\uniserv.exe "%apacheit%" 

rem ## Start MySQL server
start /MIN \usr\local\mysql\bin\mysqld-opt.exe --defaults-file=/usr/local/mysql/my.cnf

rem ### Wait for Apache to start
echo  Apache starting ....
:next
home\admin\program\unidelay.exe
if NOT exist usr\local\apache2\logs\httpd.pid goto :next

rem ### Wait for MySQL to start
echo  MySQL starting ....
:next2
home\admin\program\unidelay.exe
if NOT exist usr\local\mysql\data\mysql.pid goto :next2


echo.
echo  The Apache server is working on disk %Disk%:\ [http/127.0.0.1]
echo.
echo  To open site type http://localhost:8096 into a browser
echo.
echo  The MySQL server is working on disk %Disk%:\ [port 3316]

echo.
echo  Checking for corrupt, not cleanly closed and upgrade needing MySQL tables ...
if exist \usr\local\mysql\bin\mysqlcheck.exe call \usr\local\mysql\bin\mysqlcheck.exe --defaults-file=/usr/local/mysql/my.cnf --user=root --password=aion --all-databases --silent --force --check --auto-repair --use-frm
echo.

goto :END

:RUNNING
CLS
echo.
echo  This Apache server is already running.
echo  You can stop the server using server_stop.bat

:END
echo.
rem pause

rem ## Return to caller
popd

How can I convert bat to shell, or maybe how can I run bat files on debian?

Have you any ideas?

Hi, have you googled for bat2sh, bat2ksh or bat2bash?

Yes, but haven't found anything special

You are right there does not appear to be much out there. I guess that the structures and concepts are rather different and that anything other than symbol translations may be challenging..

If I look at you script is appears to be a wrapper script around apache. I think a better approach may be to use the standard /etc/init.d/apache2 or /etc/init.d/httpd script or similar on your system and take it from there...

Thanks, I will try. Or mayby someone else has an idea?

Hi.

I would say that one is better off looking at such problems from a new perspective rather than trying to convert command-for-command

However, there is a table of batch-to-shell equivalents at Converting DOS Batch Files to Shell Scripts for help with translation, porting, etc.

Best wishes ... cheers, drl