add run in background script
This commit is contained in:
parent
86d2de403f
commit
0cb010f320
1 changed files with 18 additions and 0 deletions
18
run.sh
Normal file
18
run.sh
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Name of the screen session
|
||||||
|
SESSION_NAME="ubertuberFrontend"
|
||||||
|
|
||||||
|
# Command to run your Node.js script
|
||||||
|
NODE_COMMAND="node /home/sparky/ubertube-backend/index.js"
|
||||||
|
|
||||||
|
# Check if the screen session already exists
|
||||||
|
if screen -list | grep -q "$SESSION_NAME"; then
|
||||||
|
echo "Session $SESSION_NAME already exists. Attaching..."
|
||||||
|
screen -r "$SESSION_NAME"
|
||||||
|
else
|
||||||
|
echo "Starting new screen session: $SESSION_NAME"
|
||||||
|
# Start a new screen session and run the Node.js script
|
||||||
|
screen -dmS "$SESSION_NAME" bash -c "$NODE_COMMAND; exec bash"
|
||||||
|
echo "Node.js script is running in the background."
|
||||||
|
fi
|
Loading…
Reference in a new issue