WIP: Start / Stop Scripts
This commit is contained in:
parent
2b7fc38ca2
commit
b84f4475e0
|
|
@ -2,11 +2,13 @@
|
|||
"DIRS": {
|
||||
"SDL_HOME": "~/.sdl",
|
||||
"SDL_CONF": "SDL_HOME/conf",
|
||||
"SDL_DOCS": "SDL_HOME/docs",
|
||||
"SDL_LOGS": "SDL_HOME/logs",
|
||||
"SDL_DIST": "SDL_HOME/dist",
|
||||
"SDL_DATA": "SDL_HOME/data",
|
||||
"SDL_PROJ": "SDL_DATA/proj",
|
||||
"SDL_JOBS": "SDL_DATA/jobs",
|
||||
"SDL_SCRIPTS": "SDL_HOME/scripts",
|
||||
"SDL_MGR": "SDL_HOME/sdl-mgr",
|
||||
"SDL_WKR": "SDL_HOME/sdl-wkr",
|
||||
"SDL_NODEJS": "SDL_HOME/nodejs"
|
||||
|
|
|
|||
|
|
@ -384,6 +384,15 @@ cd "$SDL_MGR/current/app"
|
|||
export PATH="$SDL_NODEJS/current/bin:$PATH"
|
||||
$NPM_BIN install
|
||||
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Copy Start / Stop Scripts
|
||||
# ------------------------------------------------------------
|
||||
cp "$SDL_MGR/current/scripts/start-sdl-mgr.sh" "$SDL_HOME/scripts/"
|
||||
cp "$SDL_MGR/current/scripts/stop-sdl-mgr.sh" "$SDL_HOME/scripts/"
|
||||
cp "$SDL_MGR/current/scripts/status-sdl-mgr.sh" "$SDL_HOME/scripts/"
|
||||
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Install Systemd Unit Files
|
||||
# Copy SDL_MGR/current/scripts/sdl-mgr.service to ~/.config/systemd/user
|
||||
|
|
@ -394,6 +403,14 @@ echo "Installing SystemD Unit Files"
|
|||
mkdir -p ~/.config/systemd/user
|
||||
cp "$SDL_MGR/current/scripts/sdl-mgr.service" ~/.config/systemd/user/
|
||||
|
||||
|
||||
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Start SDL Manager
|
||||
# ------------------------------------------------------------
|
||||
systemctl --user stop sdl-mgr --no-pager
|
||||
sleep 2
|
||||
systemctl --user daemon-reload --no-pager
|
||||
systemctl --user restart sdl-mgr --no-pager
|
||||
sleep 3
|
||||
|
|
@ -412,4 +429,5 @@ echo ""
|
|||
echo "Removal Commands:"
|
||||
echo " WARNING: Backup data directory first!!!!"
|
||||
echo " systemctl --user disable sdl-mgr"
|
||||
echo " rm -rf $SDL_HOME"
|
||||
echo " rm -rf $SDL_HOME"
|
||||
|
||||
|
|
|
|||
|
|
@ -48,5 +48,5 @@ echo " Node: ${NODE_BIN}"
|
|||
export PATH="${NODE_BIN_DIR}:${PATH}"
|
||||
cd "${SDL_MGR_APP_DIR}"
|
||||
|
||||
# Start in foreground (use nohup or systemd for background)
|
||||
exec "${NPM_BIN}" start
|
||||
# Start in foreground
|
||||
"${NPM_BIN}" start &
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env bash
|
||||
# status-sdl-mgr.sh - Script to show status of SDL Manager
|
||||
set -euo pipefail
|
||||
|
||||
# Get sdl-mgr PID
|
||||
SDL_MGR_PID=""
|
||||
for pid in $(pgrep -f 'node' 2>/dev/null || true); do
|
||||
cwd=$(readlink /proc/$pid/cwd 2>/dev/null || true)
|
||||
if [[ "$cwd" == *"sdl-mgr"* ]]; then
|
||||
SDL_MGR_PID="$pid"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ -z "$SDL_MGR_PID" ]]; then
|
||||
echo "SDL Manager is not running"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "SDL Manager is running with PID: ${SDL_MGR_PID}"
|
||||
exit 0
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env bash
|
||||
# status-sdl-mgr.sh - Script to show status of SDL Manager
|
||||
set -euo pipefail
|
||||
|
||||
# Get sdl-mgr PID
|
||||
SDL_MGR_PID=""
|
||||
for pid in $(pgrep -f 'node' 2>/dev/null || true); do
|
||||
cwd=$(readlink /proc/$pid/cwd 2>/dev/null || true)
|
||||
if [[ "$cwd" == *"sdl-mgr"* ]]; then
|
||||
SDL_MGR_PID="$pid"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ -z "$SDL_MGR_PID" ]]; then
|
||||
echo "SDL Manager is not running"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "SDL Manager is running with PID: ${SDL_MGR_PID}"
|
||||
exit 0
|
||||
Loading…
Reference in New Issue