2024-10-28 12:20:40 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Name of the screen session
|
|
|
|
SESSION_NAME="ubertuberFrontend"
|
|
|
|
|
|
|
|
# Command to run your Node.js script
|
2024-10-28 13:16:08 -05:00
|
|
|
NODE_COMMAND="while true; do node /home/sparky/ubertuber-backend/index.js; done"
|
2024-10-28 12:20:40 -05:00
|
|
|
|
|
|
|
# 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
|