当前位置: 首页 > news >正文

商丘建设厅网站首页如何做自动网站

商丘建设厅网站首页,如何做自动网站,WordPress商品相册,新媒体运营是做什么trap 命令用于指定在接收到信号后将要采取的动作,常见的用途是在脚本程序被中断时完成清理工作。当 shell 接收到 sigspec 指定的信号时, arg 参数(通常是执行命令)会被读取,并被执行。 1. 命令介绍 开始掌握基本的使用方式和方法 [1] 语法…

trap 命令用于指定在接收到信号后将要采取的动作,常见的用途是在脚本程序被中断时完成清理工作。当 shell 接收到 sigspec 指定的信号时, arg 参数(通常是执行命令)会被读取,并被执行。

在这里插入图片描述

1. 命令介绍

开始掌握基本的使用方式和方法

[1] 语法格式

trap [-lp] [[arg] sigspec …]
[2] 参数选项

编号 参数 含义
1 -p 列出当前设置的 trap 方法
2 -l 列出信号名称和相应的数字
[3] 常用的信号量

Number Name Notes
0 EXIT Always run on shell exit, regardless of exit code
1 SIGHUP -
2 SIGINT This is what ^C sends
3 SIGQUIT -
6 SIGABRT -
9 SIGKILL -
14 SIGALRM -
15 SIGTERM This is what kill sends by default

2. 实例说明

纸上得来终觉浅,绝知此事要躬行。

[1] 累计在退出时运行的trap工作列表

#on_exit and add_on_exit
#Usage:
#add_on_exit rm -f /tmp/foo
#add_on_exit echo “I am exiting”
#tempfile=KaTeX parse error: Expected 'EOF', got '#' at position 10: (mktemp) #̲add_on_exit rm …tempfile"

function on_exit() {
for i in “${on_exit_items[@]}”; do
eval $i
done
}

function add_on_exit() {
local n=KaTeX parse error: Expected '}', got '#' at position 2: {#̲on_exit_items[*…n]=“$*”
if [[ $n -eq 0 ]]; then
trap on_exit EXIT
fi
}

add_on_exit echo “I am exiting”
[2] 捕获SIGINT或Ctrl+C
#Run a command on signal 2 (SIGINT, which is what ^C sends)
function sigint() {
echo “Killed subshell!”
}

trap sigint INT

#This will be killed on the first ^C
echo “Sleeping…”
sleep 500
echo “Sleeping…”
sleep 500

#pressing ^C twice in a second to quit
last=0
function allow_quit() {
[ $(date +%s) -lt $(( KaTeX parse error: Expected 'EOF', got '&' at position 15: last + 1 )) ] &̲& exit echo…(date +%s)
}

trap allow_quit INT
[3] 清理临时文件
#Make a cleanup function
function cleanup() {
rm --force – “${tmp}”
}

#Trap special “EXIT” group, which is always run when the shell exits.
trap cleanup EXIT

#Create a temporary file
tmp=“(mktemp−p/tmptmpfileXXXXXXX)"echo"Hello,world!">>"(mktemp -p /tmp tmpfileXXXXXXX)" echo "Hello, world!" >> "(mktempp/tmptmpfileXXXXXXX)"echo"Hello,world!">>"{tmp}”
[4] 在退出时杀死子进程
#kill all spawned child processes of the shell on exit
trap ‘jobs -p | xargs kill’ EXIT
[5] 对终端窗口大小的变化做出反应
#signal WINCH(WINdowCHange) that is fired when one resizes a terminal window
declare -x rows cols

function update_size(){
rows=KaTeX parse error: Expected 'EOF', got '#' at position 14: (tput lines) #̲ get actual lin…(tput cols) # get actual columns of term
echo DEBUG terminal window has no $rows lines and is $cols characters wide
}

trap update_size WINCH

3. 删除进程树

一条命令也可以完成一个脚本的工作量

#How to get PID,PGID,sessionid etc ?
$ ps -o pid,ppid,pgid,gid,sess,cmd -U root
PID PPID PGID GID SESS CMD

#1.kill a group of processes with negative PID(Process ID)
$ kill -TERM -PID

#2. kill a group of processes with their PGID(Process Group ID)
$ kill – -$PGID Kill using the default signal (TERM = 15)
$ kill -9 -$PGID Kill using the KILL signal (9)

#3. kill a group processes with only PID info
$ kill – -$(ps -o pgid= $PID | grep -o [0-9]*)

#4.Using pkill, kill processes by PGID(Proess Group ID)
$ pkill -9 -g $PGID

#5.Using pkill, kill processes by GID(Group ID)
$ pkill -9 -G $GID

#6.Using pkill, kill processes by PPID(Parent Process ID)
$ pkill -9 -p $PPID

#7.Using pkill, kill processes by terminal
$ pkill -9 -t $terminal

#8.Using pkill, kill processes by process name
$ pkill -9 -x $process_name

#9.Using pkill, kill processes by session
$ pkill -9 -s $sess
新的一年
新的征程
新的课程开班
等你来学!

http://www.yayakq.cn/news/785853/

相关文章:

  • 昆明做网站推在哪个网站做失业分解
  • 广州东站建站时间微信公众号官方平台
  • 深入网站开发和运维网站首页site不到 a5
  • 制作网站找哪个公司好公司网站高端
  • 外贸网站如何建站京东网址
  • 网站是哪个公司做的好wordpress index.html
  • 深圳模板建站代理天猫网站什么时候建设
  • 网站建设做网站好吗做网站打广告犯法吗
  • 网站建设的功能模型凡科教育小程序怎么样
  • 淘掌门官方网站企业门户网站建设优势
  • 门户网站的概念百度seo点击软件
  • 专门做预言的网站电子商务网站建设的方法与流程
  • 做网站主要来源设计师培训心得
  • 建网站的注意事项公司的网站建设服务费
  • 珠海网站建设企业网页设计公司网站
  • 区块链 网站 怎么做腾讯企业邮箱购买
  • 建个网站的电话为了选择合适的网络设计方案
  • 网站seo诊断工具广州seo做得比较好的公司
  • 基本型电子商务网站成都原画培训机构排行
  • 中国建设银行最新招聘信息网站推广网站有哪些比较好
  • 十大免费ae模板网站专业网站的建设
  • 企业推广网站的方法wordpress自定义登录
  • 自适应网站 响应式网站模板wordpress 进不去后台
  • 企业网站建设管理及推广请人做网站需要注意什么条件
  • 手机网站左右滑动效果自己做网站怎么优化
  • wordpress 主题制作 加入评论泰州seo
  • 武夷山网站定制西安网页制作设计
  • 申请建设活动中心网站中国响应式网站案例
  • 攀枝花网站建设手机网站建网
  • 二手网站哪些做的比较好网页界面模板设计