Bài đăng phổ biến

Sunday, October 9, 2022

Upgrade nginx on the fly - no downtime

          #first please check pid file by:

          cat /var/run/  

#copy new binary to /sbin/nginx and force overwrite if you don't use option "-f" you will see this error : 
cp: cannot create regular file ‘/sbin/nginx’: Text file busy
/bin/cp -f nginx /sbin/nginx 

#spawn a new nginx master/workers set

kill -s USR2 `cat /var/run/`

#check process

ps aux | grep nginx

# check pid 

tail -n +1 /var/run/*

#shut down the old master's worker

kill -s WINCH `cat /var/run/`

ps aux | grep nginx

safely shut down the old master process

kill -s QUIT `cat /var/run/`

No comments:

Post a Comment

Thanks for your join,we will be reply to you asap.