-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
22 lines (18 loc) · 759 Bytes
/
run.sh
File metadata and controls
22 lines (18 loc) · 759 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
while true; do
# Perform a git fetch to check for updates without modifying your working tree.
git fetch > /dev/null 2>&1
# Check if the local branch is behind the remote branch.
if [ $(git rev-list HEAD...origin/$(git rev-parse --abbrev-ref HEAD) --count) -gt 0 ]; then
# If it is behind, pull the latest changes.
git pull > /dev/null 2>&1
# After pulling, run npm run build.
npm run build > /dev/null 2>&1
# If the build completes successfully, install dependencies and restart the bot.
if [ $? -eq 0 ]; then
npm install > /dev/null 2>&1
pm2 restart "Vtuber Bot" > /dev/null 2>&1
fi
# Sleep for 6 seconds before checking again.
sleep 6
done