当前位置:网站首页>. SH scripting
. SH scripting
2022-07-19 05:00:00 【weixin_ fifty-two million four hundred and sixty-four thousand 】
○ scripting
■ To write .sh Script for
● Put us in linux The commands executed in are written into the script
● first line #! /bin/bash Specifies the interpreter for the script /bin/bash
■ Execute the script
● Parser Script
○ Execute the script directly through the interpreter
■ /bin/bash
■ sh
■ source Execute the script through this interpreter , Will affect the current environment 、
● Give permissions to scripts
○ ./ Script name is enough
● skill
○ Variable definitions
■ name= value
■ quote
● $ Variable name
● ${ Variable name }
○ Assign a value to the result of command execution
■ The quotation marks ``
● path=`pwd`
○ The ginseng
■ Separate multiple parameters with spaces after the script
■ To obtain parameters $n To get the specified parameters
eg:
Open in the background springboot Project script
#!/bin/bash
nohup java -jar test_web-0.0.1-SNAPSHOT.jar &
close spring project
#! /bin/bash
pid=`ps aux | grep test_web-0.0.1-SNAPSHOT.jar | grep java | sed 's/\s\+/\t/g' \
| cut -f 2`
echo $pid
if [ ! $pid ];then
echo " The service has not been started "
else
kill -9 $pid
echo " The service has stopped "
fi
边栏推荐
猜你喜欢
随机推荐
邮箱发送邮件(包含附件,网易、QQ)
Bank link No. cnasp & Query (II)
事务的使用-django、 SQL工具
DSL搜索结果处理,包括排序,分页,高亮
Construction and application of knowledge map de (VI): storage, service and quality of knowledge map
一文了解配置中心
md5 密码加密
用户-注册/登录
DSL search results processing, including sorting, paging, highlighting
Encryption and decryption
es的一些概念
解决[email protected]: `node install.js` 的问题
Wechat docking mechanism memo
负载均衡器ribbon实战
索引库操作基本操作
消息转换器(json)
脱敏字段举例
Basic operations of index library operation
高等数学笔记:复合函数的二阶导数与参数方程求解曲率
redis 安装








