With the move to Rserve, a lot of the old parameters have now been removed from 
the start scripts and a lot of new code has been added. But basically the user 
now only optionally need to change the following three values:
- HEAP_SIZE
- MZMINE_STATISTICS
- TMP_FILE_DIRECTORY

I therefore suggest a general clean-up of the scripts to make things more clear 
for the users. I have attached my suggestion for the startMZmine_Windows.bat 
file where I have changed the following:

1.
Moved the three variables to the top of the scripts to make it easy for the 
users to see what parameters they can change.

2.
Cleaned the help text in the file.

3.
Added code to delete the temp folder after closing MZmine.

Please let me know what you think.

Best,

Thomas
@echo off

:: *****************************************
:: Optional values - Please modify as needed
:: *****************************************

:: Total amount of memory in MB available to MZmine 2.
:: 0 = automatically determined
:: Default: AUTO
set HEAP_SIZE=AUTO

:: Location where temporary files will be stored.
:: Default: %TEMP%
set TMP_FILE_DIRECTORY=%TEMP%

:: Allow MZmine to send anonymous statistics on the module usage? 
:: 1 = activated, 0 = deactivated
:: Default: 1
set MZMINE_STATISTICS=1

:: ********************************************
:: You don't need to modify anything below here
:: ********************************************



:: ***********************************
:: Auto detection of accessible memory
:: ***********************************

:: This is necessary to access the TOTAL_MEMORY and ADDRESS_WIDTH variables 
inside the IF block
setlocal enabledelayedexpansion

:: Obtain the physical memory size and check if we are running on a 32-bit 
system.
if exist C:\Windows\System32\wbem\wmic.exe (
  echo Checking physical memory size...
  :: Get physical memory size from OS
  for /f "skip=1" %%p in ('C:\Windows\System32\wbem\wmic.exe os get 
totalvisiblememorysize') do if not defined TOTAL_MEMORY set /a TOTAL_MEMORY=%%p 
/ 1024
  for /f "skip=1" %%x in ('C:\Windows\System32\wbem\wmic.exe cpu get 
addresswidth') do if not defined ADDRESS_WIDTH set ADDRESS_WIDTH=%%x
  echo Found !TOTAL_MEMORY! MB memory, !ADDRESS_WIDTH!-bit system
) else (
  echo Skipping memory size check, because wmic.exe could not be found
  set ADDRESS_WIDTH=32
)

:: By default we set the HEAP_SIZE to 1024 MB on 32-bit systems. On 64-bit 
systems we 
:: either set it to half of the total memory or 2048 MB less than the total 
memory.
if %HEAP_SIZE%==AUTO (
  if %ADDRESS_WIDTH%==32 (
    set HEAP_SIZE=1024
  ) else (
    if %TOTAL_MEMORY% gtr 4096 (
          set /a HEAP_SIZE=%TOTAL_MEMORY%-2048
    ) else (
          set /a HEAP_SIZE=%TOTAL_MEMORY% / 2
    )
  )
)
echo Java heap size set to %HEAP_SIZE% MB



:: *************************************************
:: Make a unique temp folder for the MZmine instance
:: *************************************************

:: DOS make sure to use 'short name' representation for temp directory
:: and forward slashed (required by features not supporting spaces or '\').
for %%f in ("%TMP_FILE_DIRECTORY%") do (set TMP_FILE_DIRECTORY=%%~sf)
for /F "usebackq tokens=1,2 delims==" %%i in (`wmic os get LocalDateTime /VALUE 
2^>NUL`) do if '.%%i.'=='.LocalDateTime.' set ldt=%%j
set ldt=%ldt:~0,4%-%ldt:~4,2%-%ldt:~6,2%_%ldt:~8,2%-%ldt:~10,2%-%ldt:~12,6%
set MZMINE_UNID=MZmine%ldt%

set TMP_FILE_DIRECTORY=%TMP_FILE_DIRECTORY%\\%MZMINE_UNID%
mkdir %TMP_FILE_DIRECTORY%



:: **********************
:: Java specific commands
:: **********************

:: It is usually not necessary to modify the JAVA_COMMAND parameter, but if you 
like to run
:: a specific Java Virtual Machine, you may set the path to the java command of 
that JVM
set JAVA_COMMAND=java

set JAVA_PARAMETERS=-showversion -classpath lib\* -Djava.ext.dirs= 
-XX:+UseParallelGC -Djava.io.tmpdir=%TMP_FILE_DIRECTORY% -Xms%HEAP_SIZE%m 
-Xmx%HEAP_SIZE%m
set MAIN_CLASS=net.sf.mzmine.main.MZmineCore

:: Starts the Java Virtual Machine
%JAVA_COMMAND% %JAVA_PARAMETERS% %MAIN_CLASS% %*

:: If there was an error, give the user a chance to see it
IF ERRORLEVEL 1 pause



:: *****************
:: Clean-up commands
:: *****************

setlocal disableDelayedExpansion

:: Kill/clean-up remaining Rserve instances
:: Load the file path "array"
for /f "tokens=1* delims=:" %%A in ('dir /b 
%TMP_FILE_DIRECTORY%\rs_pid_*.pid^|findstr /n "^"') do (
  set "file.%%A=%TMP_FILE_DIRECTORY%\%%B"
  set "file.count=%%A"
)
:: Access the values
setlocal enableDelayedExpansion
for /l %%N in (1 1 %file.count%) do (
  echo !file.%%N!
  set /P pid=<!file.%%N!
  echo !pid!
  del !file.%%N!
  taskkill /PID !pid! /F 2>nul
)

:: Delete temporary folder
RD /S /Q %TMP_FILE_DIRECTORY%
------------------------------------------------------------------------------
_______________________________________________
Mzmine-devel mailing list
Mzmine-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mzmine-devel

Reply via email to