From 9441fe97e70e1397b863abe0abb10bcc5fcfcd03 Mon Sep 17 00:00:00 2001 From: jack Date: Wed, 7 Jan 2026 21:52:55 +0000 Subject: [PATCH] Fix: Hard restart PM2 in update.sh to resolve stale environment issues --- update.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/update.sh b/update.sh index 17f45cd..a4dac5c 100755 --- a/update.sh +++ b/update.sh @@ -39,9 +39,18 @@ fi echo "✅ Update complete!" +# Determine PM2 process name (default to 'tweets-2-bsky' if not found) +PROCESS_NAME="tweets-2-bsky" +if pm2 describe twitter-mirror &> /dev/null; then + PROCESS_NAME="twitter-mirror" +fi + if command -v pm2 &> /dev/null; then - echo "🔄 Restarting PM2 process with updated environment..." - pm2 restart tweets-2-bsky --update-env || pm2 restart all --update-env + echo "🔄 Hard restarting PM2 process '$PROCESS_NAME' to fix environment paths..." + pm2 delete $PROCESS_NAME + pm2 start dist/index.js --name $PROCESS_NAME + pm2 save + echo "✅ PM2 process restarted and saved." else echo "⚠️ PM2 not found. Please restart your application manually." -fi +fi \ No newline at end of file -- 2.51.2