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/var/spool/cron files
Parallel -- nonall-j0 -- slf host. lst "hostname; ls-l/var/spool/cron"
# Set a cron task
Parallel -- nonall-j0 -- slf host. lst echo '"0 0 **** cd/root/nmon;/root/nmon-f-s600-c144">/var/spool/cron/root'
-
-- The tag parameter adds a tag for the output row
- # When there is an input parameter, the marked content is an input parameter,
- # When no parameter is input (-- nonall), the content is marked as sshlogin.
- Parallel -- tag -- nonall-j0 -- slf host. lst uptime
Scp file collection
- 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 files
Parallel -- nonall-j0 -- slf host. lst "hostname; ls-l/var/spool/cron"
# Set a cron task
Parallel -- nonall-j0 -- slf host. lst echo '"0 0 **** cd/root/nmon;/root/nmon-f-s600-c144">/var/spool/cron/root'
# -- Tag can add a tag for the output row.
# When there is an input parameter, the marked content is an input parameter,
# When no parameter is input (-- nonall), the content is marked as sshlogin.
Parallel -- tag -- nonall-j0 -- slf host. lst uptime