What's the difference between these two examples besides being able to connect to multiple servers with COZBATCH? How can I use the saf-ssh-agent in the COZBATCH example?
Thanks.
COZ Launcher
//RUNCOZ EXEC PROC=COZL,ARGS='user@server1'
//COZCFG DD *
//STDIN DD *
hostname;uname -a
ps -ef | grep abc
sar
COZBATCH
//RUNCOZ EXEC PROC=COZB
//STDIN DD *
echo Test 1
cat << EOF | ssh user@server1 "bash -ls"
hostname;uname -a
ps -ef | grep abc
sar
EOF
echo Test 2
cat << EOF | ssh user@server2 "bash -ls"
hostname;uname -a
ps -ef | grep abc
sar
EOF
Running scripts on remote servers
In your example, both do basically the same thing.
The big difference between using the Co:Z Launcher and just ssh is that with the Co:Z Launcher you can use the "todsn" and "fromdsn" commands running in the remote script to access datasets and DDs back in the launching job:
To use the saf-ssh-agent with an ssh command:
The ssh command (or any command) is run as a child process of the saf-ssh-agent command with an ssh key agent configured in the environment.
The big difference between using the Co:Z Launcher and just ssh is that with the Co:Z Launcher you can use the "todsn" and "fromdsn" commands running in the remote script to access datasets and DDs back in the launching job:
Code: Select all
//RUNCOZ EXEC PROC=COZL,ARGS='user@server1'
//COZCFG DD *
//STDIN DD *
hostname;uname -a
ps -ef | grep abc
fromdsn //HLQ.MY.DS | grep foo
//
To use the saf-ssh-agent with an ssh command:
Code: Select all
saf-ssh-agent -c MYRING ssh user@server1 cmd