Java Daemon Start Stop

From Chorke Wiki
Revision as of 21:26, 20 November 2019 by Shahed (talk | contribs) (Created page with "==Windows== ===Start=== <source lang="bat"> @echo off rem rem @author Chorke Economia<[email protected]> rem @vendor Chorke Economia, Inc. rem @web chorke.org rem @v...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Windows

Start

@echo off
rem
rem @author    Chorke Economia<[email protected]>
rem @vendor    Chorke Economia, Inc.
rem @web       chorke.org
rem @version   1.0.00
rem @since     1.0.00
rem

set "JAVA_HOME=C:\Program Files\Java\jdk1.8.0_191"
set "JRE_HOME=C:\Program Files\Java\jre1.8.0_191"
set "PATH=%JAVA_HOME%\bin;%JRE_HOME%\bin;%PATH%"
start "" javaw -jar economia-ebis-fatjar.jar
rem java -jar economia-ebis-fatjar.jar
@pause

Stop

@echo off
rem
rem @author    Chorke Economia<[email protected]>
rem @vendor    Chorke Economia, Inc.
rem @web       chorke.org
rem @version   1.0.00
rem @since     1.0.00
rem

if "%HOME%" == "" set "HOME=%USERPROFILE%"
if "%CKI_SYSTEM_NAME%" == "" set "CKI_SYSTEM_NAME=ebis"
if exist "%HOME%\.chorke\economia\etc\pid\%CKI_SYSTEM_NAME%.pid" set /p CKI_SYSTEM_PIDV=<"%HOME%\.chorke\economia\etc\pid\%CKI_SYSTEM_NAME%.pid"
if not "%CKI_SYSTEM_PIDV%" == "" taskkill /F /PID %CKI_SYSTEM_PIDV% 1>NUL
@pause

Linux

Start

#!/bin/bash
: '
@author    Chorke Economia<[email protected]>
@vendor    Chorke Economia, Inc.
@web       chorke.org
@version   1.0.00
@since     1.0.00
'

export JAVA_HOME=/opt/cli/java/jdk1.8.0_191
export JRE_HOME=/opt/cli/java/jdk1.8.0_191/jre
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
nohup java -jar economia-ebis-fatjar.jar 2>> /dev/null >> /dev/null &
printf '\n'
exit 0

Stop

#!/bin/bash
: '
@author    Chorke Economia<[email protected]>
@vendor    Chorke Economia, Inc.
@web       chorke.org
@version   1.0.00
@since     1.0.00
'

CKI_SYSTEM_NAME='ebis'
CKI_ASSETS_PATH="$HOME/.chorke/economia"
CKI_PROCES_FILE="$CKI_ASSETS_PATH/etc/pid/$CKI_SYSTEM_NAME.pid"
if [ -f "$CKI_PROCES_FILE" ];then
  CKI_SYSTEM_PIDV=`cat $CKI_PROCES_FILE`
  if ps -p $CKI_SYSTEM_PIDV > /dev/null 2>&1;then
    kill $CKI_SYSTEM_PIDV
  fi
fi
printf '\n'
exit 0