shell控制lighttpd的启动停止

2024-03-24 18:48

本文主要是介绍shell控制lighttpd的启动停止,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

写个了shell来控制lighttpd的 start stop restart ,贴上代码

#!/bin/shcmd=$1
start(){echo "start lighttpd ..."pid=`ps -ef | grep -v grep | grep -v "lighttpd.sh" | grep lighttpd | sed -n '1P' | awk '{print $2}'`if [ -z $pid ] ; then/usr/local/lighttpd/src/lighttpd -f /usr/local/lighttpd/doc/lighttpd.conf #lighttpd 启动路径elseecho "lighttpd is running!"fi
} stop(){echo "killing lighttpd..." pid=`ps -ef | grep -v grep | grep -v "lighttpd.sh" | grep lighttpd | sed -n '1P' | awk '{print $2}'`if [ -z $pid ] ; then echo "lighttpd is killing" else       killall lighttpdfi}restart(){stopstart
}status(){pid=`ps -ef | grep -v grep | grep -v "lighttpd.sh" | grep lighttpd | sed -n '1P' | awk '{print $2}'`if [ -z $pid ] ; then echo "lighttpd is not running" else       echo "lighttpd is  running" fi
}help(){echo "Usage: $0 {start|stop|restart|status}"
}case ${cmd} in[Ss][Tt][Aa][Rr][Tt])start;; [Ss][Tt][Oo][Pp]) stop;;[Rr][Ee][Ss][Tt][Aa][Rr][Tt])restart;; [Hh][Ee][Ll][Pp])help;;[Ss][Tt][Aa][Tt][Uu][Ss])status;;*)echo "please read stop or start!";;
esac

感觉shell挺有意思的,类似与c,但又有php的感觉!


这篇关于shell控制lighttpd的启动停止的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/842456

相关文章

SpringBoot 多环境开发实战(从配置、管理与控制)

《SpringBoot多环境开发实战(从配置、管理与控制)》本文详解SpringBoot多环境配置,涵盖单文件YAML、多文件模式、MavenProfile分组及激活策略,通过优先级控制灵活切换环境... 目录一、多环境开发基础(单文件 YAML 版)(一)配置原理与优势(二)实操示例二、多环境开发多文件版

Java实现远程执行Shell指令

《Java实现远程执行Shell指令》文章介绍使用JSch在SpringBoot项目中实现远程Shell操作,涵盖环境配置、依赖引入及工具类编写,详解分号和双与号执行多指令的区别... 目录软硬件环境说明编写执行Shell指令的工具类总结jsch(Java Secure Channel)是SSH2的一个纯J

SpringBoot通过main方法启动web项目实践

《SpringBoot通过main方法启动web项目实践》SpringBoot通过SpringApplication.run()启动Web项目,自动推断应用类型,加载初始化器与监听器,配置Spring... 目录1. 启动入口:SpringApplication.run()2. SpringApplicat

解决Nginx启动报错Job for nginx.service failed because the control process exited with error code问题

《解决Nginx启动报错Jobfornginx.servicefailedbecausethecontrolprocessexitedwitherrorcode问题》Nginx启... 目录一、报错如下二、解决原因三、解决方式总结一、报错如下Job for nginx.service failed bec

Spring Boot项目如何使用外部application.yml配置文件启动JAR包

《SpringBoot项目如何使用外部application.yml配置文件启动JAR包》文章介绍了SpringBoot项目通过指定外部application.yml配置文件启动JAR包的方法,包括... 目录Spring Boot项目中使用外部application.yml配置文件启动JAR包一、基本原理

解决若依微服务框架启动报错的问题

《解决若依微服务框架启动报错的问题》Invalidboundstatement错误通常由MyBatis映射文件未正确加载或Nacos配置未读取导致,需检查XML的namespace与方法ID是否匹配,... 目录ruoyi-system模块报错报错详情nacos文件目录总结ruoyi-systnGLNYpe

解决hive启动时java.net.ConnectException:拒绝连接的问题

《解决hive启动时java.net.ConnectException:拒绝连接的问题》Hadoop集群连接被拒,需检查集群是否启动、关闭防火墙/SELinux、确认安全模式退出,若问题仍存,查看日志... 目录错误发生原因解决方式1.关闭防火墙2.关闭selinux3.启动集群4.检查集群是否正常启动5.

shell脚本批量导出redis key-value方式

《shell脚本批量导出rediskey-value方式》为避免keys全量扫描导致Redis卡顿,可先通过dump.rdb备份文件在本地恢复,再使用scan命令渐进导出key-value,通过CN... 目录1 背景2 详细步骤2.1 本地docker启动Redis2.2 shell批量导出脚本3 附录总

Spring Boot集成/输出/日志级别控制/持久化开发实践

《SpringBoot集成/输出/日志级别控制/持久化开发实践》SpringBoot默认集成Logback,支持灵活日志级别配置(INFO/DEBUG等),输出包含时间戳、级别、类名等信息,并可通过... 目录一、日志概述1.1、Spring Boot日志简介1.2、日志框架与默认配置1.3、日志的核心作用

Springboot项目启动失败提示找不到dao类的解决

《Springboot项目启动失败提示找不到dao类的解决》SpringBoot启动失败,因ProductServiceImpl未正确注入ProductDao,原因:Dao未注册为Bean,解决:在启... 目录错误描述原因解决方法总结***************************APPLICA编