首页 > 系统相关 >Shell - sleep

Shell - sleep

时间:2023-08-06 10:44:05浏览次数:29  
标签:ZZHPC Shell 120 job bg sleep zzh

zzh@ZZHPC:~$ sleep 120
^Z
[1]+  Stopped                 sleep 120
zzh@ZZHPC:~$ bg %1
[1]+ sleep 120 &
zzh@ZZHPC:~$ 
[1]+  Done                    sleep 120

10:01开始sleep,执行完后立刻执行Ctrl + Z中止。

10:02执行bg %1 (bg sleep也可以)来resume sleep进程。

10:03 sleep进程完成。

这说明进程中止期间的时间也算在sleep内,不会重新从resume那一刻起sleep剩余的时间。

 

zzh@ZZHPC:~$ bg --help
bg: bg [job_spec ...]
    Move jobs to the background.
    
    Place the jobs identified by each JOB_SPEC in the background, as if they
    had been started with `&'.  If JOB_SPEC is not present, the shell's notion
    of the current job is used.
    
    Exit Status:
    Returns success unless job control is not enabled or an error occurs.

zzh@ZZHPC:~$ fg --help
fg: fg [job_spec]
    Move job to the foreground.
    
    Place the job identified by JOB_SPEC in the foreground, making it the
    current job.  If JOB_SPEC is not present, the shell's notion of the
    current job is used.
    
    Exit Status:
    Status of command placed in foreground, or failure if an error occurs.

zzh@ZZHPC:~$ sleep 120
^Z
[1]+  Stopped                 sleep 120
zzh@ZZHPC:~$ bg sleep
[1]+ sleep 120 &
zzh@ZZHPC:~$ fg sleep
sleep 120
zzh@ZZHPC:~$

 

标签:ZZHPC,Shell,120,job,bg,sleep,zzh
From: https://www.cnblogs.com/zhangzhihui/p/17609158.html

相关文章

  • 我写了一个shell脚本然后加密了
    原文链接:我写了一个shell脚本然后加密了hello,大家晚上好啊,今天为大家带来一个小工具--shc。shc是一个可以用来对shell脚本进行加密的工具,它操作起来很方便,它的作用是将我们编写的shell脚本可以转换为一个可执行的二进制文件,起到加密的作用,当然,GitHub上也有很多的工具用来解析shc生......
  • win11 xshell 应用程序无法正常启动(0xc000007b)。请单击“确定”关闭应用程序。
    安装 最新支持的VisualC++可再发行程序包下载|MicrosoftDocs下载x86版本下载x86版本下载x86版本正常打开。......
  • shell 脚本:nginx jdk maven node-exporter docker-ce
     写一个脚本,本地自带nginx1.24源码包,然后自动完成安装,并加入system管理。并设置开启自启动,并启动ng。并完成对80端口的curl测试,返回状态码200打印启动正常的消息:#!/bin/bash#安装依赖sudoapt-getupdatesudoapt-getinstall-ybuild-essentialwgetcurl#下载并解......
  • 【答疑】jsonpath和beanshell配合使用案例
    问题今天提升群小伙伴问了这样一个问题:接口返回如下(list元素个数不确定),需要提取所有的iautoid,然后用逗号拼接起来,如果是如下返回,需要得到的结果是1687283717749342208,1679392630364184576,后续请求需要使用{ "data":{ "firstPage":true, "lastPage":false, "list":......
  • Xshell使用技巧及常用配置
    Xshell使用1、调整Xshell的终端显示和回滚缓冲区大小磨刀不误砍柴工,为了更方便地学习Linux,首先得对终端进行一些调整,步骤如下:首先通过xshell顶部菜单中的文件-->属性,打开会话属性窗口,然后点终端,按下图配置:调整终端显示和回滚缓冲区的说明如下。终端选择为Linux(有网......
  • shell 8.3
    bash基础内置命令echo命令-n不换行输出-e解析字符串的特殊字符eval执行多个命令eg:evalls;cd/tmpexec不创建子进程,执行后续命令,且执行命令完后自动exit${变量}返回变量值${#name}返回变量长度,字符长度${变量:start}返回变量start之后的${变量:start:length}${变......
  • shell 读取文件内容到数组
     在shell脚本中,可以使用下面的语法来读取文件内容并将其存储到数组中: bash复制代码array=()whilereadline;doarray+=("$line")done<file.txtLOG_INFO(){localcontent=${1}echo-e"\033[32m[INFO]${content}\033[0m"}IFS=''catbanner.......
  • shell 将文件内容读取到 数组中
    #!/bin/bashprod_file=/home/vmuser/linbo/kettleDemo/job/test/CA-20201224.csvtest_file=/home/vmuser/linbo/kettleDemo/job/test/uat_CA-20201224.csvdtm=`date+"%Y%m%d%H%M%S"`echo$dtmrowCnt=`cat$test_file|wc-l`echo$rowCntecho"-----......
  • Linux Shell实现模拟多进程并发执行
        在bash中,使用后台任务来实现任务的“多进程化”。在不加控制的模式下,不管有多少任务,全部都后台执行。也就是说,在这种情况下,有多少任务就有多少“进程”在同时执行。我们就先实现第一种情况:实例一:正常情况脚本———————————————————————————–#......
  • shell 8.2
    特殊变量:$0获取脚本文件名,以及脚本路径$n获取shell的第n个参数,n在1~9之间$#获取参数的总个数$*获取shell脚本的所有参数(接受整体字符串)$@获取shell脚本的所有参数(接受单个字符串)一些语法:-ne不等于 ......