0

I have a file /tmp/hostlist containing hosts 1000+ . I am trying to fetch line which has particular word from crontab -l on 1000+ hosts via pssh command to expedite the task, but unable to fetch the line

I am trying below command. The reason for using echo \$(echo ) is to display the output in same line when triggering more than one OS command

pssh -h /tmp/hostlist -i "echo \$(echo ), \$(crontab -l|grep root)"

The above command works fine when i replaced "crontab -l|grep root" with any OS Command , Having an issue with crontab -l -> It doesn't display the expected output.

Just to add-

The above command works when using only one Command as below.

pssh -h /tmp/hostlist -i 'crontab -l|grep -i root'  --> Works fine

Is there any possibility to use more than one command and display output in one line with crontab -l command like below.

pssh -h /tmp/hostlist -i "echo \$(echo ), \$(crontab -l|grep root),  \$(uptime)"   --> doesn't work or doesn't give expected output of crontab -l|grep root

and when using below without crontab command works fine.

pssh -h /tmp/hostlist -i "echo \$(echo ), \$(uname -a),  \$(uptime)" --> Works fine
4

0 回答 0