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

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

These files will now print an error and quit if the log directory is missing

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