From bd3c71dd51591d171dcddbc1d7716bd57764edea Mon Sep 17 00:00:00 2001 From: Aymeric Bernard <aymeric.bernard@student.ecp.fr> Date: Sat, 14 Apr 2018 17:34:07 +0200 Subject: [PATCH] screen only starts chromium, that will query the back. Update script refactor --- scripts/.screenrc_tv_panel | 8 +++----- scripts/update_server.sh | 42 +++++++++++++++++++++++++------------- 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/scripts/.screenrc_tv_panel b/scripts/.screenrc_tv_panel index 5688bc4..538da0a 100755 --- a/scripts/.screenrc_tv_panel +++ b/scripts/.screenrc_tv_panel @@ -29,8 +29,6 @@ bind f eval "hardstatus ignore" bind F eval "hardstatus alwayslastline" # Windows at startup -screen -t "tvp_back" 0 bash -c 'cd /home/hermod/tv_panel && yarn start:prod' -screen -t "tvp_front" 1 bash -c 'cd /home/hermod/tv_panel && yarn start:front' -screen -t "tvp_chromium" 2 bash -c 'cd /home/hermod/tv_panel && DISPLAY=:0 ./front/start.sh' -screen -t bash 3 bash -select 3 +screen -t "tvp_chromium" 0 bash -c 'DISPLAY=:0 xdotool mousemove 10000 10000 && chromium-browser --kiosk --incognito --disable-gpu http://localhost:5000' +screen -t bash 1 bash +select 1 diff --git a/scripts/update_server.sh b/scripts/update_server.sh index c59ad3a..31cff82 100755 --- a/scripts/update_server.sh +++ b/scripts/update_server.sh @@ -1,21 +1,35 @@ #!/bin/bash -if [ $NODE_ENV = "production" ] +if [[ "$NODE_ENV" != "production" ]] then - # Pull code - git fetch - # git reset --hard origin/master + read -p "The env if not production, this script can remove uncommitted changes. Are you sure you want to continue? [y/N] " prompt + if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]] + then + echo "Pursuing..." + else + echo "Aborted." + exit 1 + fi +fi - # Install deps - yarn install --pure-lockfile +# Pull code +echo "Fetching the code..." +git fetch +# git reset --hard origin/master - # Build front - yarn build:front +# Install deps +echo "Installing dependencies..." +yarn install --pure-lockfile - # Restart server - # pm2 startOrRestart ./scripts/ecosystem.config.json +# Build front +echo "Building front-end..." +yarn build:front - # Restart screen - # screen -S TVPanelScreen -X quit - # ./scripts/start_tv_panel.sh -fi \ No newline at end of file +# Restart server +echo "Restarting the back-end server..." +pm2 startOrRestart ./scripts/ecosystem.config.json + +# Restart screen +echo "Restarting the screen..." +screen -S TVPanelScreen -X quit +./scripts/start_tv_panel.sh -- GitLab