问题:nginx 作为反向代理, thin 开了3个进程, 在production 模式下需要重启。为了保证网站一直可用,分别需要逐个重启。windows不支持linux下的restart。
解决办法:batch
思路:通过端口找到pid,然后强行taskkill 之, 重新启动。
代码:
FOR /F "tokens=5 delims= " %%P IN ('netstat -a -n -o ^| findstr :3000 ^| findstr LISTENING ') DO start /wait taskkill /F /PID %%P
@ping 127.0.0.1 -n 2 -w 300 > nul
start /min thin start -e production -p 3000
@ping 127.0.0.1 -n 2 -w 50000 > nul
解释:
行1:通过netstat 显示端口和进程pid关联信息,通过findstr portnumber和 listening 过滤信息,然后通过 for 语句单独获得pid传给变量%P,最后用taskkill /F /PID强行杀掉
行2、4:休息一下
行3:在另外的窗口启动thin
副作用:
你还得把原有窗口自己关掉。这个现在懒得解决,等待有志之士补充。
分享到:
相关推荐
进程监控,自动重启进程
软件看门狗,国外的,很好用,可以延时启动程序。
RestartOnCrash一个监控进程的小工具,可用于监控iis/apache/mysql等程序 此程序相当于一个服务器小保姆一样,而且功能还是比较全的程序使用很简单
PowerShell重启服务(Restart-Service),使用PowerShell可以很方便的操作Windows系统服务,比如实现自动重启服务。本文就介绍如何使用PowerShell来重启服务,以及一些相关的内容。PowerShell中重启服务的cmdlet是...
主页»HowTo»Enable TLS 1.2 on Windows XP 文章2754 Enable TLS 1.2 on Windows XP To enable TLS 1.2 on Windows XP: 1.Download PosReady.zip 2.Extract the.zip file 3.Double click and import PosReady.reg 4...
oracle restart windows 10 batch file. firststop service then start it.
dism /online /norestart /add-package /packagepath:Microsoft-Windows-Lxss-Optional-Package.cab /packagepath:Microsoft-Windows-Lxss-Optional-Package-en-US.cab /packagepath:Microsoft-Windows-Lxss-Package...
重启windows资源管理器(explorer)的bat脚本
Go to the C: drive using Windows Explorer and double-click on full.exe. Or, open a DOS window (Start > Programs > Command Prompt), connect to the C: drive using the cd command, and type full. ...
This is the most secure choice if you know that the people who will connect to your computer are running Windows 7 on their computers. (In Windows 7, Remote Desktop uses Network Level Authentication....
Linux 系统重启Tomcat shell脚本 将脚本中的basedir改为项目路径,并保证执行用户拥有目录的读、写、执行权限
Demo for Restart Application self
问:在安装STEP7的过程中一直提示重启系统如何处理? 答:修改注册表,方法如下: 开始——运行——输出regedit 在注册表内“HKEY——LOCAL——MACHINE\ SYSTEM\Current Control Set\ Control \ ...
omap4-restart.c - Common to OMAP4 and OMAP5.
omap2-restart.c - code common to all OMAP2xxx machines.
omap3-restart.c - Code common to all OMAP3xxx machines.
WINDOWS和DOS重启程序
java开发常用服务中间件重启脚本,实现开机自动启动所有服务
关于GR通用的基本概念,原理,以及作用,请参考《网络之路-OSPF专题讨论》中的文章《OSPF Graceful Restart》。 该文对于GR的来源,作用和通原理做了详细的介绍,本文将跳过这方面,直接进入BGP GR实现的介绍。
手机重启工具,解放电源建,sony z1可用