Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
2 votes
2 answers
7k views

Using exec in find over ssh from shell script

So, I am attempting to execute the following from within a shell script; ssh -q $CUR_HOST "cd $LOGS_DIR; echo cd $LOGS_DIR; find . -name *.log -mmin +1440 -exec gzip {} \; exit" When this runs, it ...
Skittles's user avatar
  • 143
3 votes
2 answers
4k views

Variable assigned inside ssh command doesn't return proper value

I'm executing the below command in the ssh part of my script. The command is meant to cut the file size from ls option and storing it to a variable. Then print the variable: echo "Enter srouce file"; ...
user73405's user avatar
5 votes
2 answers
18k views

About escape with SSH pipe

I want to execute the awk command with long parameters,like this: ssh host "netstat -rn|awk 'NR!=1 && NF>=6 && $1!="Destination" {printf "%-15s %-20s\n", $1, $2}'|sort -f " but ...
CatWin's user avatar
  • 51
1 vote
1 answer
1k views

For loop not getting executed correctly over ssh

I have a script in which I am reading from a csv file where it contains SourceIp, DestinationIP,Source Ports, Destination Ports. First I am reading the sourceIp and trying to do ssh over it (I am ...
saurav's user avatar
  • 249
3 votes
1 answer
3k views

variable expansion within command substitution over SSH bash 4.X

I want to do this ssh ${w100user}@web100 'ls -l "$(grep "${1}" /etc/pure-ftpd/pureftpd.passwd|cut -d':' -f6)"' Which obviously performs an ssh session to server web100 as w100user and then greps ...
Gregg Leventhal's user avatar
17 votes
4 answers
27k views

bash adds extra single quotes

I have a problem executing my script. When executing it in debug mode (bash -x), I can see that bash is adding extra quotes. Therefor my script is failing. Here this is within my script: testvar="\...
user2452585's user avatar
1 vote
3 answers
396 views

the difference between '..' and ".." when I use ssh usr@ip 'pscp ......'

My Server machine run Window,and it installed Cygwin. My Client machine run linux. In Clinent machine.I do this: [sikaiwei@login-1-2 v1.4]$ bash test.sh CHUN~19900405 [email protected]:/ifs2/...
orange's user avatar
  • 75
1 vote
1 answer
696 views

date doesn't accept its own output

What is the option for date to give output in a format acceptable to date --set ? I'm trying to remotely set the date, using the current computer clock of my workstation. ssh user@host sudo date --...
Ben Voigt's user avatar
  • 309
4 votes
2 answers
13k views

How to run a remote sed command through ssh if the data includes double quotes ("")?

I'm trying to run through a list of servers and run the next command: itaig@itaig-lt:~$ ssh root@$srvname "sed -i 's/VNCSERVERARGS[6]="-geometry 1920x1080"/VNCSERVERARGS[6]="-geometry 1152x864"/g' /...
Itai Ganot's user avatar
2 votes
1 answer
3k views

permission denied executing script over ssh

When a web page is loaded on server A i want it to run a script on server B. I can do this with a series of commands from server A by logging into server B and executing the script, but it needs to be ...
dab's user avatar
  • 21
0 votes
1 answer
794 views

Quotes exercise - how to do ssh inside ssh whilst running sql inside second ssh? [duplicate]

Possible Duplicate: Quoting in ssh $host $FOO and ssh $host “sudo su user -c $FOO” type constructs Wrapping a command that includes single and double quotes for another command I want to run ...
Radek's user avatar
  • 3,013
0 votes
1 answer
412 views

How to run svn when ssh over ssh?

I need to run sudo -u wwwrun sh -c 'svn status -uq /srv/www/htdocs/loquat' over ssh. When using one ssh it works smoothly. Now there is one server that needs to be connected through another server via ...
Radek's user avatar
  • 3,013
3 votes
2 answers
3k views

Execute command through SSH

I am writing a script to check whether all the servers in my organization are functioning properly. One of those is Zimbra mail server. I am trying to send a mail through sendmail provided by zimbra ...
Dharmit's user avatar
  • 4,330
2 votes
2 answers
2k views

Run ssh as a command of another ssh command

I want to run a program on a machine that I have ssh access to from a gateway machine that I can access with ssh too. When I want to run an mpi program on the target machine T, I access to the ...
0xFF's user avatar
  • 381
33 votes
4 answers
14k views

Quoting in ssh $host $FOO and ssh $host "sudo su user -c $FOO" type constructs

I often end up issuing complex commands over ssh; these commands involve piping to awk or perl one-lines, and as a result contain single quotes and $'s. I have neither been able to figure out a hard ...
Leo Alekseyev's user avatar

15 30 50 per page