Update shinobi cmd
parent
aed15d3623
commit
d905d4d4a1
|
@ -6,14 +6,10 @@ else
|
||||||
fi
|
fi
|
||||||
cd "$installationDirectory" || exit
|
cd "$installationDirectory" || exit
|
||||||
currentBuild=$(git show --oneline -s)
|
currentBuild=$(git show --oneline -s)
|
||||||
gitOrigin=$(git remote show origin)
|
# gitOrigin=$(git remote show origin)
|
||||||
splitBuildString=($currentBuild)
|
splitBuildString=($currentBuild)
|
||||||
currentCommitNumber=${splitBuildString[0]}
|
currentCommitNumber=${splitBuildString[0]}
|
||||||
if [[ $gitOrigin == *'ShinobiCE'* ]]; then
|
repo="Pro"
|
||||||
repo="CE"
|
|
||||||
else
|
|
||||||
repo="Pro"
|
|
||||||
fi
|
|
||||||
if [[ $@ == *'help'* ]] || [ ! "$1" ]; then
|
if [[ $@ == *'help'* ]] || [ ! "$1" ]; then
|
||||||
echo "========================================================="
|
echo "========================================================="
|
||||||
echo "==!! Shinobi : The Open Source CCTV and NVR Solution !!=="
|
echo "==!! Shinobi : The Open Source CCTV and NVR Solution !!=="
|
||||||
|
@ -49,10 +45,10 @@ if [[ $@ == *'help'* ]] || [ ! "$1" ]; then
|
||||||
echo "|--> Update via Git."
|
echo "|--> Update via Git."
|
||||||
echo "-"
|
echo "-"
|
||||||
echo "| getMaster :"
|
echo "| getMaster :"
|
||||||
echo "|--> Switch to the Master Branch (For Pro Repo only)."
|
echo "|--> Switch to the Master Branch."
|
||||||
echo "-"
|
echo "-"
|
||||||
echo "| getDev :"
|
echo "| getDev :"
|
||||||
echo "|--> Switch to the Development Branch (For Pro Repo only)."
|
echo "|--> Switch to the Development Branch."
|
||||||
echo "-"
|
echo "-"
|
||||||
echo "| clear, flush :"
|
echo "| clear, flush :"
|
||||||
echo "|--> Clear all PM2 logs."
|
echo "|--> Clear all PM2 logs."
|
||||||
|
@ -70,35 +66,17 @@ if [[ $@ == *'clear'* ]] || [[ $@ == *'flush'* ]]; then
|
||||||
pm2 flush
|
pm2 flush
|
||||||
fi
|
fi
|
||||||
if [[ $@ == *'restart'* ]]; then
|
if [[ $@ == *'restart'* ]]; then
|
||||||
proccessAlive=$(pm2 list | grep camera)
|
pm2 restart camera
|
||||||
if [ "$proccessAlive" ]; then
|
|
||||||
pm2 restart "$installationDirectory"/camera.js
|
|
||||||
pm2 restart "$installationDirectory"/cron.js
|
|
||||||
else
|
|
||||||
echo "Shinobi process is not running."
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
if [[ $@ == *'start'* ]] || [[ $@ == *'now'* ]]; then
|
if [[ $@ == *'start'* ]] || [[ $@ == *'now'* ]]; then
|
||||||
proccessAlive=$(pm2 list | grep camera | grep online)
|
|
||||||
if [ "$proccessAlive" ]; then
|
|
||||||
echo "Shinobi process is already running."
|
|
||||||
else
|
|
||||||
if [ -e "$installationDirectory/INSTALL/installed.txt" ]; then
|
|
||||||
echo "Starting Shinobi"
|
echo "Starting Shinobi"
|
||||||
pm2 start "$installationDirectory"/camera.js
|
pm2 start camera
|
||||||
pm2 start "$installationDirectory"/cron.js
|
|
||||||
fi
|
|
||||||
if [ ! -e "$installationDirectory/INSTALL/installed.txt" ]; then
|
|
||||||
chmod +x "$installationDirectory"/INSTALL/now.sh&&INSTALL/now.sh
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [[ $@ == *'stop'* ]] || [[ $@ == *'exit'* ]]; then
|
if [[ $@ == *'stop'* ]] || [[ $@ == *'exit'* ]]; then
|
||||||
proccessAlive=$(pm2 list | grep camera)
|
proccessAlive=$(pm2 list | grep camera)
|
||||||
if [ "$proccessAlive" ]; then
|
if [ "$proccessAlive" ]; then
|
||||||
pm2 stop "$installationDirectory"/camera.js
|
pm2 stop camera
|
||||||
pm2 stop "$installationDirectory"/cron.js
|
|
||||||
else
|
else
|
||||||
echo "Shinobi process is not running."
|
echo "Shinobi process is not running."
|
||||||
fi
|
fi
|
||||||
|
@ -121,20 +99,12 @@ if [[ $@ == *'bootupDisable'* ]] || [[ $@ == *'bootupdisable'* ]]; then
|
||||||
pm2 save
|
pm2 save
|
||||||
fi
|
fi
|
||||||
if [[ $@ == *'getDev'* ]] || [[ $@ == *'getdev'* ]]; then
|
if [[ $@ == *'getDev'* ]] || [[ $@ == *'getdev'* ]]; then
|
||||||
if [[ $repo == "Pro" ]]; then
|
|
||||||
git checkout dev
|
git checkout dev
|
||||||
echo "Shinobi - Restart Shinobi to make the changes take affect."
|
echo "Shinobi - Restart Shinobi to make the changes take affect."
|
||||||
else
|
|
||||||
echo "Shinobi - Cannot use \"getDev\" with Shinobi CE"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
if [[ $@ == *'getMaster'* ]] || [[ $@ == *'getmaster'* ]]; then
|
if [[ $@ == *'getMaster'* ]] || [[ $@ == *'getmaster'* ]]; then
|
||||||
if [[ $repo == "Pro" ]]; then
|
|
||||||
git checkout master
|
git checkout master
|
||||||
echo "Shinobi - Restart Shinobi to make the changes take affect."
|
echo "Shinobi - Restart Shinobi to make the changes take affect."
|
||||||
else
|
|
||||||
echo "Shinobi - Cannot use \"getMaster\" with Shinobi CE"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
if [[ $@ == *'update'* ]]; then
|
if [[ $@ == *'update'* ]]; then
|
||||||
echo "============="
|
echo "============="
|
||||||
|
@ -143,14 +113,10 @@ if [[ $@ == *'update'* ]]; then
|
||||||
read -r updateshinobi
|
read -r updateshinobi
|
||||||
if [ "$updateshinobi" = "y" ] || [ "$updateshinobi" = "Y" ]; then
|
if [ "$updateshinobi" = "y" ] || [ "$updateshinobi" = "Y" ]; then
|
||||||
echo "Beginning Update Process..."
|
echo "Beginning Update Process..."
|
||||||
pm2 stop "$installationDirectory"/camera.js
|
pm2 stop camera.js
|
||||||
pm2 stop "$installationDirectory"/cron.js
|
rm -rf node_modules
|
||||||
npm install --unsafe-perm
|
sh UPDATE.sh
|
||||||
# npm audit fix --force
|
pm2 start camera.js
|
||||||
git reset --hard
|
|
||||||
git pull
|
|
||||||
pm2 start "$installationDirectory"/camera.js
|
|
||||||
pm2 start "$installationDirectory"/cron.js
|
|
||||||
else
|
else
|
||||||
echo "Cancelled Update Process."
|
echo "Cancelled Update Process."
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue