Home > php教程 > php手册 > body text

使用GNU parallel

WBOY
Release: 2016-06-13 08:42:33
Original
2077 people have browsed it

使用GNU parallel

批量创建cron任务:
  1. # host.lst 是主机列表


    # 查看当前cron任务
    parallel --nonall -j0 --slf host.lst "hostname;crontab -l"


    # 查看/var/spool/cron文件
    parallel --nonall -j0 --slf host.lst "hostname;ls -l /var/spool/cron"


    # 设置cron任务
    parallel --nonall -j0 --slf host.lst echo '"0 0 * * * cd /root/nmon;/root/nmon/nmon -f -s600 -c144" > /var/spool/cron/root'

--tag参数为输出行增加标记
  1. # 当有输入参数时,标记内容是输入参数,
  2. # 当无输入参数(--nonall)时,标记内容为sshlogin。
  3. parallel --tag --nonall -j0 --slf host.lst uptime

scp收集文件
  1. parallel -a host.lst scp '"{}:/root/nmon/*160401*.nmon"' .



  • # host.lst 是主机列表


    # 查看当前cron任务
    parallel --nonall -j0 --slf host.lst "hostname;crontab -l"


    # 查看/var/spool/cron文件
    parallel --nonall -j0 --slf host.lst "hostname;ls -l /var/spool/cron"


    # 设置cron任务
    parallel --nonall -j0 --slf host.lst echo '"0 0 * * * cd /root/nmon;/root/nmon/nmon -f -s600 -c144" > /var/spool/cron/root'

  • # --tag可以为输出行增加标记。
    # 当有输入参数时,标记内容是输入参数,
    # 当无输入参数(--nonall)时,标记内容为sshlogin。
    parallel --tag --nonall -j0--slf host.lst uptime
  • Related labels:
    source:php.cn
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Recommendations
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template