Skip to main content
edited tags
Link
Gilles 'SO- stop being evil'
  • 865.3k
  • 205
  • 1.8k
  • 2.3k
added 4 characters in body
Source Link
Anthon
  • 81.4k
  • 42
  • 174
  • 228

I'm trying to execute some commands on remote host like this :

ssh -t -t -l user 172.20.20.20 <<EOF
  pid=$(ps -ef | grep [a]pp-management | awk '{print $2}') && kill -9 $pid && rm -rf CI/*
EOF

What happens is that I remain logged at remote server and the kill is not executed :

user@ubuntu:~$ pid= && kill -9  && rm -rf CI/*
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]

Neither rmrm gets executed, what am I doing wrong? I

I see that nothing get passed to kill -9 command, why is this?

I'm trying to execute some commands on remote host like this :

ssh -t -t -l user 172.20.20.20 <<EOF
  pid=$(ps -ef | grep [a]pp-management | awk '{print $2}') && kill -9 $pid && rm -rf CI/*
EOF

What happens is that I remain logged at remote server and the kill is not executed :

user@ubuntu:~$ pid= && kill -9  && rm -rf CI/*
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]

Neither rm gets executed, what am I doing wrong? I see that nothing get passed to kill -9 command, why is this?

I'm trying to execute some commands on remote host like this :

ssh -t -t -l user 172.20.20.20 <<EOF
  pid=$(ps -ef | grep [a]pp-management | awk '{print $2}') && kill -9 $pid && rm -rf CI/*
EOF

What happens is that I remain logged at remote server and the kill is not executed :

user@ubuntu:~$ pid= && kill -9  && rm -rf CI/*
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]

Neither rm gets executed, what am I doing wrong?

I see that nothing get passed to kill -9 command, why is this?

Source Link

Execute command on remote host fails

I'm trying to execute some commands on remote host like this :

ssh -t -t -l user 172.20.20.20 <<EOF
  pid=$(ps -ef | grep [a]pp-management | awk '{print $2}') && kill -9 $pid && rm -rf CI/*
EOF

What happens is that I remain logged at remote server and the kill is not executed :

user@ubuntu:~$ pid= && kill -9  && rm -rf CI/*
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]

Neither rm gets executed, what am I doing wrong? I see that nothing get passed to kill -9 command, why is this?