Home > Backend Development > PHP Tutorial > Tutorial on using GNU parallel_PHP

Tutorial on using GNU parallel_PHP

WBOY
Release: 2016-07-12 08:55:09
Original
1975 people have browsed it

Use GNU parallel

Create cron tasks in batches:
  1. # host.lst is the host list


    # View the current cron task
    parallel --nonall -j0 --slf host.lst "hostname;crontab -l"


    # View the /var/spool/cron file
    parallel --nonall -j0 - -slf host.lst "hostname;ls -l /var/spool/cron"


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

--tag parameter adds a tag to the output line
  1. # When there are input parameters, the marked content is the input parameters,
  2. # When there are no input parameters (-- nonall), the marked content is sshlogin.
  3. parallel --tag --nonall -j0 --slf host.lst uptime

scp collection file
  1. parallel -a host .lst scp '"{}:/root/nmon/*160401*.nmon"' .



  • # host.lst is the host list


    # View the current cron task
    parallel --nonall -j0 --slf host.lst "hostname;crontab -l"


    # View /var/spool /cron file
    parallel --nonall -j0 --slf host.lst "hostname;ls -l /var/spool/cron"


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

  • # --tag can add tags to output lines.
    # When there are input parameters, the marked content is the input parameters.
    # When there are no input parameters (--nonall), the marked content is sshlogin.
    parallel --tag --nonall -j0--slf host.lst uptime
  • www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1117249.htmlTechArticleUse GNU parallel to create cron tasks in batches: # host.lst is the host list # View the current cron task parallel --nonall -j0 --slf host.lst "hostname;crontab -l" # View /var/spool/cron file...
  • 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 Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template