zoukankan      html  css  js  c++  java
  • nohup 测试记录


    终端操作

    一、java HelloJava

    1. ctrl+C 进程关闭

    2. 手动关闭终端 进程关闭

    3. exec.sh
    #!/bin/bash
    cd /home/wlanuser/z07732
    java HelloJava

    ./exec.sh ctrl+C 进程关闭
    ./exec.sh 手动关闭终端 进程关闭
    nohup sh exec.sh ctrl+C 进程关闭
    nohup sh exec.sh 手动关闭终端 进程不关闭
    nohup sh exec.sh & exit退出终端进程不关闭
    nohup sh exec.sh & 手动关闭终端,进程不关闭

    二、java HelloJava &

    1. 手动关闭终端 进程关闭

    2. 手敲exit命令退出终端 进程不关闭

    3. exec.sh
    [root@master z07732]# cat exec.sh
    #!/bin/bash
    cd /home/wlanuser/z07732
    java HelloJava &

    ./exec.sh 手动关闭终端,进程不关闭
    ./exec.sh exit命令退出终端,进程不关闭
    nohup sh exec.sh exit命令退出终端,进程不关闭
    nohup sh exec.sh 手动关闭终端 进程不关闭
    nohup sh exec.sh & exit退出终端进程不关闭
    nohup sh exec.sh & 手动关闭终端,进程不关闭

    4. exec.sh
    [root@master z07732]# more exec.sh
    #!/bin/bash
    cd /home/wlanuser/z07732
    java HelloJava &
    exit 0

    ./exec.sh 手动关闭终端,进程不关闭
    ./exec.sh exit命令退出终端,进程不关闭
    nohup sh exec.sh exit命令退出终端,进程不关闭
    nohup sh exec.sh 手动关闭终端 进程不关闭
    nohup sh exec.sh & exit退出终端,进程不关闭
    nohup sh exec.sh & 手动关闭终端,进程不关闭

    三、nohup java HelloJava

    1. 手动关闭终端,进程不关闭
    2. ctrl+C 进程关闭

    3. ./exec.sh

    [root@master z07732]# cat exec.sh
    #!/bin/bash
    cd /home/wlanuser/z07732
    nohup java HelloJava

    ./exec.sh ctrl+C 进程关闭
    ./exec.sh 手动关闭终端,进程不关闭
    nohup sh exec.sh ctrl+C 进程关闭
    nohup sh exec.sh 手动关闭终端 进程不关闭
    nohup sh exec.sh & exit退出终端,进程不关闭
    nohup sh exec.sh & 手动关闭终端,进程不关闭

    [root@master z07732]# cat exec.sh ------------------这个脚本应该 上面的是一样的,会挂在nohup这行走不到exit
    #!/bin/bash
    cd /home/wlanuser/z07732
    nohup java HelloJava
    exit 0

    ./exec.sh ctrl+C 进程关闭
    ./exec.sh 手动关闭终端,进程不关闭
    nohup sh exec.sh ctrl+C 进程关闭
    nohup sh exec.sh 手动关闭终端 进程不关闭
    nohup sh exec.sh & exit退出终端,进程不关闭
    nohup sh exec.sh & 手动关闭终端,进程不关闭

    四、nohup java HelloJava &
    1. 手动关闭终端,进程不关闭
    2. exit命令退出终端,进程不关闭

    3. ./exec.sh
    [root@master z07732]# cat exec.sh
    #!/bin/bash
    cd /home/wlanuser/z07732
    nohup java HelloJava &

    ./exec.sh 手动关闭终端,进程不关闭
    ./exec.sh exit命令退出终端,进程不关闭
    nohup sh exec.sh exit退出终端,进程不关闭
    nohup sh exec.sh 手动关闭终端 进程不关闭
    nohup sh exec.sh & exit退出终端,进程不关闭
    nohup sh exec.sh & 手动关闭终端,进程不关闭

    [root@master z07732]# cat exec.sh
    #!/bin/bash
    cd /home/wlanuser/z07732
    nohup java HelloJava &
    exit 0

    ./exec.sh 手动关闭终端,进程不关闭
    ./exec.sh exit命令退出终端,进程不关闭

    API
    一、
    [root@node2 mongo-hive-hbase]# cat Hive_HistClientsInfoAnalysis_temp.sh
    #!/bin/bash

    nohup hive -S -e "select a.acSN,date_sub(to_date(from_unixtime(unix_timestamp(),'yyyy-MM-dd HH:mm:ss')),2),count(a.clientMAC) from (select acSN,clientMAC from hbase_testtable0801 where to_date(uplineDate)=date_sub(to_date(from_unixtime(unix_timestamp(),'yyyy-MM-dd HH:mm:ss')),2) group by acSN,clientMAC) a group by a.acSN;" &


    nohup hive -S -e "select sub1.acsn, date_sub(to_date(from_unixtime(unix_timestamp(),'yyyy-MM-dd HH:mm:ss')),2),count(sub1.clientMac) as addClientCounts from (select acsn,clientMAC from hbase_testtable0801 where to_date(uplinedate)=date_sub(to_date(from_unixtime(unix_timestamp(),'yyyy-MM-dd HH:mm:ss')),2) group by acsn,clientmac) sub1 left join (select acsn,clientmac from hbase_testtable0801 where to_date(uplinedate) < date_sub(to_date(from_unixtime(unix_timestamp(),'yyyy-MM-dd HH:mm:ss')),2) group by acsn, clientmac) sub2 on (sub1.acsn = sub2.acsn and sub1.clientMAC = sub2.clientMAC) where sub2.clientMAC is NULL group by sub1.acsn;" &

    cd /home/mongo-hive-hbase/; sh Hive_HistClientsInfoAnalysis_temp.sh 代码里不sleep就关闭连接,会导致Hive任务没执行
    cd /home/mongo-hive-hbase/; nohup sh Hive_HistClientsInfoAnalysis_temp.sh 代码里不sleep就关闭连接,会导致Hive任务没执行
    cd /home/mongo-hive-hbase/; nohup sh Hive_HistClientsInfoAnalysis_temp.sh & 代码里不sleep就关闭连接,会导致Hive任务没执行

    二、

    [root@node2 mongo-hive-hbase]# more Hive_HistClientsInfoAnalysis_temp.sh
    #!/bin/bash

    hive -S -e "select a.acSN,date_sub(to_date(from_unixtime(unix_timestamp(),'yyyy-MM-dd HH:mm:ss')),2),count(a.clientMAC) from (select acSN,clientMAC from hbase_testtable0801 where to_date(upline
    Date)=date_sub(to_date(from_unixtime(unix_timestamp(),'yyyy-MM-dd HH:mm:ss')),2) group by acSN,clientMAC) a group by a.acSN;" &


    hive -S -e "select sub1.acsn, date_sub(to_date(from_unixtime(unix_timestamp(),'yyyy-MM-dd HH:mm:ss')),2),count(sub1.clientMac) as addClientCounts from (select acsn,clientMAC from hbase_testtabl
    e0801 where to_date(uplinedate)=date_sub(to_date(from_unixtime(unix_timestamp(),'yyyy-MM-dd HH:mm:ss')),2) group by acsn,clientmac) sub1 left join (select acsn,clientmac from hbase_testtable080
    1 where to_date(uplinedate) < date_sub(to_date(from_unixtime(unix_timestamp(),'yyyy-MM-dd HH:mm:ss')),2) group by acsn, clientmac) sub2 on (sub1.acsn = sub2.acsn and sub1.clientMAC = sub2.clien
    tMAC) where sub2.clientMAC is NULL group by sub1.acsn;" &


    cd /home/mongo-hive-hbase/; sh Hive_HistClientsInfoAnalysis_temp.sh 代码里不sleep就关闭连接,会导致Hive任务没执行
    cd /home/mongo-hive-hbase/; nohup sh Hive_HistClientsInfoAnalysis_temp.sh 代码里不sleep就关闭连接,会导致Hive任务没执行
    cd /home/mongo-hive-hbase/; nohup sh Hive_HistClientsInfoAnalysis_temp.sh & 代码里不sleep就关闭连接,会导致Hive任务没执行


    三、sleep
    [root@node2 mongo-hive-hbase]# cat Hive_HistClientsInfoAnalysis_temp.sh
    #!/bin/bash

    hive -S -e "select a.acSN,date_sub(to_date(from_unixtime(unix_timestamp(),'yyyy-MM-dd HH:mm:ss')),2),count(a.clientMAC) from (select acSN,clientMAC from hbase_testtable0801 where to_date(uplineDate)=date_sub(to_date(from_unixtime(unix_timestamp(),'yyyy-MM-dd HH:mm:ss')),2) group by acSN,clientMAC) a group by a.acSN;" &

    hive -S -e "select sub1.acsn, date_sub(to_date(from_unixtime(unix_timestamp(),'yyyy-MM-dd HH:mm:ss')),2),count(sub1.clientMac) as addClientCounts from (select acsn,clientMAC from hbase_testtable0801 where to_date(uplinedate)=date_sub(to_date(from_unixtime(unix_timestamp(),'yyyy-MM-dd HH:mm:ss')),2) group by acsn,clientmac) sub1 left join (select acsn,clientmac from hbase_testtable0801 where to_date(uplinedate) < date_sub(to_date(from_unixtime(unix_timestamp(),'yyyy-MM-dd HH:mm:ss')),2) group by acsn, clientmac) sub2 on (sub1.acsn = sub2.acsn and sub1.clientMAC = sub2.clientMAC) where sub2.clientMAC is NULL group by sub1.acsn;" &

    sleep 60

    cd /home/mongo-hive-hbase/; sh Hive_HistClientsInfoAnalysis_temp.sh 代码里不sleep就关闭连接,会导致Hive任务没执行
    cd /home/mongo-hive-hbase/; nohup sh Hive_HistClientsInfoAnalysis_temp.sh 代码里不sleep就关闭连接,会导致Hive任务没执行
    cd /home/mongo-hive-hbase/; nohup sh Hive_HistClientsInfoAnalysis_temp.sh & 代码里不sleep就关闭连接,会导致Hive任务没执行

  • 相关阅读:
    VUE课程参考---2、VUE基本使用
    VUE课程---1、VUE课程介绍
    JS数组常用方法---3、pop方法使用及原理
    JavaScript中数组元素删除的七大方法汇总
    Stack的三种含义
    JS数组常用方法---6、reverse方法
    数据库水平切分的实现原理解析---分库,分表,主从,集群,负载均衡器
    服务框架HSF分析之一容器启动
    淘宝HSF服务的原理以及简单的实现
    DAS 原文出自【比特网】
  • 原文地址:https://www.cnblogs.com/zhengchunhao/p/5849385.html
Copyright © 2011-2022 走看看