Re: remote ssh commands

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Brien Dieterle
Date:  
To: Main PLUG discussion list
Subject: Re: remote ssh commands
You probably have a blank line in your serverlist.txt, resulting in
$server being null:

ping .localdomain
PING .localdomain(localhost (::1%1)) 56 data bytes
64 bytes from localhost (::1): icmp_seq=1 ttl=64 time=0.017 ms
64 bytes from localhost (::1): icmp_seq=2 ttl=64 time=0.022 ms



On Tue, May 31, 2016 at 9:22 PM, Nadim Hoque <> wrote:
> Fellow Pluggers,
>
> So I am trying to perform a remote poweroff command and for some reason the
> host powers itself off. I am able to run another command such as yum just
> fine but when I try to execute the poweroff command the host turns off as
> well. Below is the script that I am running
>
>
>
> #!/bin/bash
>
> for server in $(cat serverlist.txt); do
>        ssh $server.localdomain 'yum update -y && poweroff'
> done

>
> Also note that the serverlist.txt does not contain the host itself. Thanks
> for the help.
>
> Nadim Hoque
>
>
> ---------------------------------------------------
> PLUG-discuss mailing list -
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss