-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathstartpm2.sh
executable file
·27 lines (23 loc) · 942 Bytes
/
startpm2.sh
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
#!/usr/bin/env bash
if [[ -e ${HOME}/.nvm/nvm.sh ]]; then
export NVM_DIR="$HOME/.nvm"
# shellcheck source=/home/chrisl8/.nvm/nvm.sh
[[ -s "$NVM_DIR/nvm.sh" ]] && . "$NVM_DIR/nvm.sh" # This loads nvm
fi
if [[ -e ${HOME}/.config/nvm/nvm.sh ]]; then
export NVM_DIR="$HOME/.config/nvm"
# shellcheck source=/home/chrisl8/.nvm/nvm.sh
[[ -s "$NVM_DIR/nvm.sh" ]] && . "$NVM_DIR/nvm.sh" # This loads nvm
fi
# USB Relay Controller
if [[ "$(jq '.useUSBrelay' "${HOME}"/.arlobot/personalDataForBehavior.json)" == true ]]; then
echo "Turning off all relays"
"${HOME}"/ArloBot/scripts/switch_relay_name.sh all off
fi
# Give the system a moment to finish booting before we come online.
# Adjust as needed, or as you see fit.
# Even as little as 5 or 10 is probably fine, or pick a process to watch
# check does above.
sleep 15
cd "${HOME}"/ArloBot/node/ || exit 1
"${NVM_DIR}"/current/bin/pm2 start "${HOME}"/ArloBot/node/pm2Config.json