Sponsored Content
Full Discussion: remote ssh commands help
Top Forums Shell Programming and Scripting remote ssh commands help Post 302294024 by jcalisi on Wednesday 4th of March 2009 10:04:08 AM
Old 03-04-2009
remote ssh commands help

I have a script that I'm trying to use that will check for files on a remote machine and if there is files copy the files, modify the perm on the copied files, and then delete the files off of the remote server. Right now I need to get the correct syntax so the the remote commands still interpret my local defined variables.

I should note that I'm not strong in scripting as well as this script is still work in progress.

Code:
#!/bin/bash
#script used to move patches from server to server 
#
FS="server"
FILES="/cygdrive/e/Information\\ Systems/To_Staging/"
DEST=/campus_data/
#
for campus in `cat campus_list`
        do
                ssh mover@$FS 'ls "$FILES$campus/"' > file_list
                if [ -s file_list ]; then  
                `scp mover@$FS:"$FILES$campus/*" /campus_data/$campus`
                rm -f file_list
                else
                echo "file_list is blank for" $campus
        fi
        done
exit

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

SSH, Remote Commands and echo, oh my!

So, HostB has a SSH trust via pre-shared keys from HostA. HostA> ssh HostB hostname HostB HostA> ssh HostB echo `hostname` HostA HostA> ssh HostB 'echo `hostname`' `hostname` HostA> ssh HostB "echo `hostname`" HostA HostA> ssh HostB echo $PS1 user@HostA:$PWD HostA> ssh HostB... (12 Replies)
Discussion started by: Wrathe
12 Replies

2. Shell Programming and Scripting

Send Remote Commands via SSH with variables

Hi there I found the Command to send commands to other servers like: sv01> ssh user@sv02 'ps -ef' But I cant use Variables from a script i want to execute on another server like: sv01> ssh user@sv02 'cd $SCRIPTHOME' although the variable is set on sv01. How can I run commands on sv02 with... (2 Replies)
Discussion started by: DarkSwiss
2 Replies

3. UNIX for Dummies Questions & Answers

how to stay in remote shell after executing commands in ssh?

the ssh calling convention: ssh <server> If I put commands in the section, ssh will execute them immediately after logging in and return to local shell. I want to stay in the remote shell after executing these commands. How can I achieve this? Thanks for all. (1 Reply)
Discussion started by: hplonlien
1 Replies

4. Shell Programming and Scripting

executing commands in remote server using ssh

I have some commands which need to be executed in remote machine. I have Linux Server from where I need to connect to Solaris server using ssh and then declare some variable over there and run some commands. I don't want to call a script which is present in Solaris server from Linux server... (7 Replies)
Discussion started by: maitree
7 Replies

5. Shell Programming and Scripting

Executing remote commands via ssh

Hi, I'm tryin to write a script that will collect information about a remote servers, put them into variables and print them to screen. # /usr/bin/bash ls $1 > /dev/null 2>/dev/null if then echo "$1 is file" for server in $(cat $1) do # echo $server ... (5 Replies)
Discussion started by: moshesa
5 Replies

6. Shell Programming and Scripting

Shell script help to execute ssh remote commands

Hi, The below command is not giving me the count , Can somebody help me in re-writing this pls . Proc_Exist=`ssh -q -o "BatchMode=yes" -o "PasswordAuthentication=no" $OAUSER@${Primary_Node} ps -ef | grep -v grep | grep "${ICM_Proc}" |wc -l ` Also the same problem with below... (13 Replies)
Discussion started by: Y.balakrishna
13 Replies

7. Shell Programming and Scripting

Remote ssh commands

ssh XXXXX@XXXXX'. $HOME/.profile 2>/dev/null;cd $COMMON_TOP/admin/scripts/$CONTEXT_NAME; adcmctl.sh start "apps${AppsPass}" || cd $ADMIN_SCRIPTS_HOME; adcmctl.sh start "apps${AppsPass}"' As per our business requirement we should be able to execute the above two commands seprated with or ( || )... (4 Replies)
Discussion started by: Y.balakrishna
4 Replies

8. Shell Programming and Scripting

Running Commands on a Remote Linux Server over SSH

Hello, I'm trying to create a ksh script to ssh to a remote server, enter the password and a couple commands. For security reasons I have changed the login, password and ip in my example. #!/bin/ksh ssh -t -t username@12.5.5.3 << EOF password cd bin pwd EOF When I run it. It... (5 Replies)
Discussion started by: seekryts15
5 Replies

9. Shell Programming and Scripting

Ssh - running commands on remote server

Hi, I am trying to run commands on a list of servers that I can ssh to and just want to know if there is a 'cleaner' way of doing this. At the moment, I am doing as below. Is there a way that I can escape the double quote differently? If a use a single quote to enclose the commands that I... (1 Reply)
Discussion started by: newbie_01
1 Replies

10. Shell Programming and Scripting

Commands not working with ssh remote login

Hi Friends, I am unable to run our application commands on remote server using ssh (passwordless login enabled). But the same command running with telent perl script. please suggest. SSH: C:/bin>ssh -l monitor tl04cp01 exec "/home/monitor/123" /home/monitor/123: viewlog: not found. ... (7 Replies)
Discussion started by: suresh3566
7 Replies
uuxqt(1)						      General Commands Manual							  uuxqt(1)

NAME
uuxqt - Executes remote command requests SYNOPSIS
uuxqt [-ssystem] [-xdebug_level] The uuxqt program executes specified commands on designated remote systems. OPTIONS
Specifies the name of the remote system. Use this option only when starting uuxqt manually. The remote system name is supplied internally when uuxqt is started automatically. Displays debugging information on the screen of the local system; debug_level is a single digit between 0 and 9. The higher the number specified, the more detailed the debugging information displayed. DESCRIPTION
When uux is entered by a user, the program creates the necessary C.* (Command), D.* (Data), and X.* (Execute) files and places them in the spooling directory on the designated remote system. The uux command then calls the uucico daemon which in turn, tries to contact the designated system to deliver the files. When the files are transferred, uuxqt executes the commands on the designated system. The uuxqt program searches the spool directories on the designated system for the X.* (Execute) files whose names indicate that they were sent from another system. The command checks each X.* file for the following: All of the required D.* (Data) files must be available and accessible. File commands must be permitted for the requesting system. The uuxqt program can be executed manually by a user with superuser privileges. This daemon is executed automatically by the uudemon.hour shell script, which is started periodically by cron. FILES
Lock file which prevents multiple use of device Limits number of remote command executions Access permission codes SEE ALSO
Commands: uucico(8), uucp(1), uustat(1), uux(1) uuxqt(1)
All times are GMT -4. The time now is 02:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy