source: main/trunk/greenstone2/gs2-server.bat@ 22572

Last change on this file since 22572 was 22572, checked in by sjm84, 14 years ago

Renamed gs2-server.bat to gs2-web-server.bat and created a new script called gs2-server.bat that runs either the apache server (gs2-web-server.bat) or the local library server (server.exe) depending on whether or not server.exe exists

  • Property svn:executable set to *
File size: 1.3 KB
Line 
1@echo off
2pushd "%CD%"
3CD /D "%~dp0"
4
5set GSDLHOME=%CD%
6
7:checkUserPermissions
8 echo Checking if the Greenstone log directory is writable ...
9 (echo This is a temporary file. It is safe to delete it. > "%GSDLHOME%\etc\logs-gsi\testing.tmp" ) 2>nul
10 if exist "%GSDLHOME%\etc\logs-gsi\testing.tmp" goto deleteTempFile
11 if "%1" == "Elevated" goto printWarning
12 echo ... FAILED
13 echo The Greenstone server cannot write to the log directory (%GSDLHOME%\etc\logs-gsi)
14 echo Requesting elevated status to become admin user to continue.
15 "%GSDLHOME%\bin\windows\gstart.exe" %0 Elevated %1 %2 %3 %4 %5 %6 %7 %8 %9
16 goto done
17
18:printWarning
19 echo ... FAILED
20 echo The Greenstone server cannot write to the log directory (%GSDLHOME%\etc\logs-gsi).
21 echo Attempting to continue without permissions.
22 goto shiftElevated
23
24:deleteTempFile
25 echo ... OK
26 del "%GSDLHOME%\etc\logs-gsi\testing.tmp"
27
28:shiftElevated
29 :: Shift "Elevated" (one of our own internal command words) out of the way if present
30 :: so the command-line is as it was when the user initiated the command
31 if "%1" == "Elevated" shift
32
33:checkserver
34 if exist "%GSDLHOME%\server.exe" goto localserver
35 goto webserver
36
37:localserver
38 start /MIN cmd /C "%GSDLHOME%\server.exe"
39 goto done
40
41:webserver
42 call "%GSDLHOME%\gs2-web-server.bat"
43 goto done
44
45:done
46popd
Note: See TracBrowser for help on using the repository browser.