首页 > 其他分享 >通过bat启动与关停服务

通过bat启动与关停服务

时间:2023-12-25 11:56:36浏览次数:23  
标签:bat exe 启动 %% 关停 echo nginx REM

参考:https://lcx.cc/post/816/


1. startup.bat

@echo off
REM change current directory
D:
cd D:\xxxxxx\nginx-1.24.0

REM set envi variable
SET "PATH=%PATH%;D:\xxxxxx\nginx-1.24.0\contrib"


REM start nginx
start nginx

echo start nginx process at 127.0.0.1:9090


pause



2. shutdown.bat

@echo off
set program=nginx.exe
echo program: %program%

taskkill /IM %program% /F

REM for /f "tokens=5" %%a in ('netstat -ano ^| findstr "9090"') do taskkill /pid %%a -t -f

REM 普通级别强杀“lsass.exe”进程。
REM for /f "tokens=2,3*" %i in ('tasklist /nh ^| find "lsass.exe"') do ntsd -c q -p %i

REM 驱动级强行杀死所有名为“stormliv.exe”的进程(可以干掉网维等产品)。
REM for /f "tokens=1,2" %%i in ('tasklist') do (echo %%i | findstr /i "stormliv.exe" 1>nul 2>nul && (ntsd -c q -p %%j & set qq=%%i))


echo The process %program% has been terminated.

paus

标签:bat,exe,启动,%%,关停,echo,nginx,REM
From: https://www.cnblogs.com/gispathfinder/p/17925799.html

相关文章

  • Linux 启动MySQL 报错:Status:“Server shutdown complete“ Error:13(权限不够)
    Status:“Servershutdowncomplete”Error:13(权限不够)我在银河麒麟V10系统中安装启动MySQL出现的一个错误:“Servershutdowncomplete”Error:13(权限不够),我在其他系统中没有遇到到。问题背景在国产化系统银河麒麟V10上尝试启动MySQL服务器时,可能会收到如下错误信息:Status:"Ser......
  • [CSharpTips]C# 设置应用程序开机自启动
    C#设置应用程序开机自启动主要是通过动态生成vbs脚本,放置在系统自启动目录下,系统开机时会自动执行vbs脚本启动应用程序开机自启动,自动生成vbs脚本 using(StreamWriterfile=newStreamWriter($@"{Environment.GetFolderPath(Environment.SpecialFolder.Startup)}\StartU......
  • MyBatisPlus简介及快速搭建
    一、简介MyBatisPlus(简称MP)是一个MyBatis的增强工具,在MyBatis的基础上只做增强,不做改变,为简化开发,提高效率而生。特性及官网链接(简称苞米豆):可在IDEA中安装以下插件:MybatisX:支持跳转,自动补全生成SQL;dynamic-datasource:基于SpringBoot的多数据源组件,功能强悍,支持Seat......
  • xv6 磁盘中断流程和启动时调度流程
    本文讲述xv6中的一些细节流程,还有对之前文中遗留的问题做一些补充说明,主要有以下几个问题:一次完整的磁盘中断流程进入调度器后的详细流程sched函数中的条件判断scheduler函数中为什么要周期性关中断一次完整的磁盘流程此节讲述完整的磁盘读写流程,读写的流程总体差不多,这里以读......
  • docker 启动报错 library initialization failed - unable to allocate file descript
    docker启动报错library initialization failed-unabletoallocatefiledescriptortable-outofmemory1.报错日志libraryinitializationfailed-unabletoallocatefiledescriptortable-outofmemory/cm-server/aiboxCloud-web/boot/entrypoint.sh:line2:......
  • org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis
    Requestprocessingfailed;nestedexceptionisorg.mybatis.spring.MyBatisSystemException:nestedexceptionisorg.apache.ibatis.binding.BindingException:Parameter'keyWord'notfound.Availableparametersare[keyword,param1] 错误原因:我在mapper里加......
  • mybatis实现多对一和一对多
    1、多对一实现概述:多个学生对应一个老师1.1按照查询嵌套查询学生实体类@DatapublicclassUserimplementsSerializable{privatestaticfinallongserialVersionUID=1L;@TableIdprivateLongid;/**用户名称*/privateStringusername......
  • mybatis与mybatisplus
    使用这个不会造成冲突 同时不要把<dependency><groupId>org.mybatis.spring.boot</groupId><artifactId>mybatis-spring-boot-starter</artifactId><version>3.0.3</version></dependency>删除<dependency><grou......
  • kaggle Open Problems – Single-Cell Perturbations 1st & 2nd place solution summa
    Leaderboard:https://www.kaggle.com/competitions/open-problems-single-cell-perturbations/leaderboard2ndSolution:https://www.kaggle.com/competitions/open-problems-single-cell-perturbations/discussion/458738Code:https://github.com/Eliorkalfon/single_ce......
  • mybatis错误:Parameter 'companyName' not found. Available parameters are [arg3, ar
    问题:mybatis.binding.BindingException:Parameter'companyName’notfound.Availableparametersare[arg3,arg2解决:原因是DAO层传入参数mapper无法识别,只需要在在DAO中的方法中前加入@Param(“xxx”)即可,在mapper.xml中使用xxx作为传参.intselectBy4Params(Stringco......