Fix PM2 UID type error by using login shell and explicit undefined
- Use su with login shell (-) to ensure clean environment - Explicitly set uid/gid to undefined in ecosystem config - This prevents PM2 from trying to parse string UID as integer The error occurred because PM2 was receiving '1002' as a string instead of an integer. By using a login shell and explicitly setting uid/gid to undefined, PM2 won't try to switch users. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -92,7 +92,8 @@ fi
|
||||
# Start PM2 as the user with HOME environment set
|
||||
echo "Starting PM2 as user $user..."
|
||||
cd /home/$user/app
|
||||
su -c "HOME=/home/$user NODE_ENV=production pm2 start ecosystem.config.js --no-daemon" $user &
|
||||
# Use su with login shell to ensure clean environment
|
||||
su - $user -c "cd /home/$user/app && NODE_ENV=production pm2 start ecosystem.config.js --no-daemon" &
|
||||
|
||||
# Give PM2 time to start
|
||||
sleep 5
|
||||
|
Reference in New Issue
Block a user