command "allssh genesis stop prism" not found in script

Badge +2
I'm writing " restart cluster script " from this topic
I have some problem and can't find resolve

command >> allssh genesis stop prism >> it's work i command line but,
not working when it on script

ssh.exec_command("source /etc/profile;ncli cluster set-external-ip-address external-ip-address=x.x.x.x;allssh genesis stop prism;cluster start")

all command are working but only "allssh genesis stop prism" is not working

thank you for your help.

3 replies

Userlevel 2
Badge +12
Rinnamo allssh is a shell built-in function that is executed only in interactive shells. Since your script will be running in a non-interactive shell use the following command to execute the same action

ssh nutanix@ 'source /etc/profile; for i in $(svmips); do ssh $i "source /etc/profile; genesis stop prism"; done'In the above command just replace the cvmip with your controller vm ip address
Badge +2
it's work!

thank you 🙂
Userlevel 2
Badge +12
Rinnamo Glad it worked. Please don't forget to mark the thread resolved.