Description of problem:
Attempt to restart a client using remote execution results in error shutdown: command not found
Version-Release number of selected component (if applicable):
> Satellite 6.8
> In some cases it fails.
Steps to Reproduce:
> Unknown. But the workaround mentioned in additional info helped to resolve the issue.
> Restart task fails with the following error
2:/var/tmp/foreman-ssh-cmd-d1c44834-3875-4db1-ae22-e58a75f8fbb4/script: line 4: shutdown: command not found
3:Exit status: 127
> Should restart the host without any error.
> There is a chance that the initialization of the PATH variable is not happening on the target host properly or it's not properly set for the SSH User.
The simple workaround is to modify the "Power Action - SSH Default" template with the absolute path of the "shutdown" command. Use "/sbin/shutdown" as this path is available on RHEL 6, 7, and 8.
echo <%= input('action') %> host && sleep 3
<%= case input('action')
'/sbin/shutdown -r +1'
'/sbin/shutdown -h now'