This repository has been archived by the owner on Aug 2, 2019. It is now read-only.
forked from NodeBB/NodeBB
-
Notifications
You must be signed in to change notification settings - Fork 1
/
nodebb.bat
122 lines (90 loc) · 2.31 KB
/
nodebb.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
@echo off
rem %1 action
rem %2 subaction
setlocal enabledelayedexpansion
2>nul call :CASE_%1
if ERRORLEVEL 1 call :DEFAULT_CASE
exit /B
:CASE_start
echo Starting NodeBB
echo "nodebb.bat stop" to stop the NodeBB server
echo "nodebb.bat log" to view server output
rem Start the loader daemon
node loader %*
goto END_CASE
:CASE_stop
call :pidexists
if %_result%==0 (
echo NodeBB is already stopped.
) else (
echo Stopping NodeBB. Goodbye!
rem Doing this forcefully is probably not the best method
taskkill /PID !_pid! /f>nul
)
goto END_CASE
:CASE_restart
echo Unsupported
goto END_CASE
:CASE_reload
echo Unsupported
goto END_CASE
:CASE_status
call :pidexists
if %_result%==0 (
echo NodeBB is not running
echo "nodebb.bat start" to launch the NodeBB server
) else (
echo NodeBB Running ^(pid !_pid!^)
echo "nodebb.bat stop" to stop the NodeBB server
echo "nodebb.bat log" to view server output
echo "nodebb.bat restart" to restart NodeBB
)
goto END_CASE
:CASE_log
cls
type .\logs\output.log
goto END_CASE
:CASE_upgrade
call npm install
call npm i nodebb-theme-vanilla nodebb-theme-lavender nodebb-widget-essentials
node app --upgrade
copy /b package.json +,,>nul
goto END_CASE
:CASE_setup
node app --setup %*
goto END_CASE
:CASE_reset
node app --reset --%2
goto END_CASE
:CASE_dev
echo Launching NodeBB in "development" mode.
echo To run the production build of NodeBB, please use "forever".
echo More Information: https://docs.nodebb.org/en/latest/running/index.html
set NODE_ENV=development
node loader --no-daemon %*
goto END_CASE
:CASE_watch
echo Not supported
goto END_CASE
:DEFAULT_CASE
echo Welcome to NodeBB
echo Usage: nodebb.bat ^{start^|stop^|reload^|restart^|log^|setup^|reset^|upgrade^|dev^|watch^}
goto END_CASE
:END_CASE
endlocal
VER > NUL
goto :EOF
:pidexists
if exist %~dp0pidfile (
set /p _pid=<pidfile
for /f "usebackq" %%Z in (`tasklist /nh /fi "PID eq !_pid!"`) do (
if %%Z==INFO: (
del pidfile
set _result=0
) else (
set _result=1
)
)
) else (
set _result=0
)