Use GNU parallel
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 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
- # 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
scp collection file
- 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
http://www.bkjia.com/PHPjc/1117249.htmlwww.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...
Statement: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