使用GNU parallel
Release: 2016-06-13 08:42:33
Original
2077 people have browsed it
使用GNU parallel
批量创建cron任务:
- # 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
scp收集文件
- 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
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
Latest Articles by Author
-
2024-10-22 09:46:29
-
2024-10-13 13:53:41
-
2024-10-12 12:15:51
-
2024-10-11 22:47:31
-
2024-10-11 19:36:51
-
2024-10-11 15:50:41
-
2024-10-11 15:07:41
-
2024-10-11 14:21:21
-
2024-10-11 12:59:11
-
2024-10-11 12:17:31