Sponsored Content
Top Forums Shell Programming and Scripting How to run a shell script on a remote host using ftp Post 302672471 by mrskittles99 on Monday 16th of July 2012 11:43:52 AM
Old 07-16-2012
Quote:
Originally Posted by Tribe
You can run the watch command on the remote machine and while it is running the script will be executed. The script can be multiline:

Execute the script on the remote machine every 60 seconds
Code:
echo > mycommands.sh
watch -n60 "chmod +x timedcommand.sh && ./timedcommand.sh"

Remotely overwrite the mycommands.sh file via ftp.

You can upload an empty file to stop commands.
I'm not supposed to be running the script that often, is there a different way to do this? I also have remsh on the host. can remsh run scripts?
 

10 More Discussions You Might Find Interesting

1. IP Networking

FTP - Connection Closed By Remote Host

Hi, I am having a problem with our AIX 4.3.3 Server accessing FTP. The error is " Connection Closed By Remote Host". Scenario: Since i put a default gateway on the server FTP connection is having a problem but when i remove the default gateway it will works fine.. Is there any way not... (1 Reply)
Discussion started by: mouglybean
1 Replies

2. Shell Programming and Scripting

How can my unix shell script automatically connect to remote host?

How can my unix shell script automatically connect to remote host? Assume that there is a remote host called "rhost". When I connect to that host i give the command "telnet rhost". It then asks me for my id and password. Once i give it connects there. I want to automate these steps. I want... (8 Replies)
Discussion started by: digdarshan
8 Replies

3. Shell Programming and Scripting

Run Shell Script on Remote System

I honestly tried searching for this in this forum and in google. Maybe I found the answer but didn't even realized it. I would like to run shell script thats on my machine that collects the hostname and IP address from the remote system and sends the output to my machine. I'm not sure if need... (2 Replies)
Discussion started by: elbombillo
2 Replies

4. Shell Programming and Scripting

Run a shell script from one host which connext to remote host and run the commands

I want to write a script which would run from one host say A and connect to other remote host B and then run rest of commands in that host. I tried connecting from A host to B with SSH but after connecting to host B it just getting me inside Host B command prompt. Rest of the script is not running... (6 Replies)
Discussion started by: SN2009
6 Replies

5. Shell Programming and Scripting

Executing scipts after logging into a remote host using shell script

Hi All, Sorry if it is a duplicate post. I have not got any reference about this anywhere. I looked at the posts described in SSH - Passing Unix login passwords through shell scripts - Linux / UNIX Forum and it helped me till the point to connect to the host and executing the basic commands.... (3 Replies)
Discussion started by: RSC1985
3 Replies

6. UNIX for Dummies Questions & Answers

Run a script on remote host

Hi, I wish to run a script located on a remote host machineB from machineA. I am using ssh and running the below on machineA. However, the ssh does not seem to work and freezes at ssh -l wlsadmin machineB -v Sun_SSH_1.1.2, SSH protocols 1.5/2.0, OpenSSL 0x0090704f debug1: Reading... (9 Replies)
Discussion started by: shifahim
9 Replies

7. Shell Programming and Scripting

HTML Code to Run a Script from Remote Unix Host

Hi All, Noticed few posts around this but coudnt get exatcly what i wanted. Thanks for your help again. I have a script running on a remote machine and i normally ssh from putty and run the script manually. Is there anyway that i can write an HTML Code with a button so taht when I Click... (1 Reply)
Discussion started by: robinbannis
1 Replies

8. Shell Programming and Scripting

Run script on remote host

Hi friends, I have two servers. Server A and B. I want to run one script on server A by logging in to server B. Can anyone provide me code for this.? I tried it by using following ssh username@serverA ./script Then it prompt me the password. I give correct password of the server A. but it... (7 Replies)
Discussion started by: Nakul_sh
7 Replies

9. Shell Programming and Scripting

Run awk command on remote host

I have below command to check for error logs from last 24 hours from the file : /var/log/messages/ The command is working fine on the local host. sudo awk -F - -vDT="$(date --date="24 hours ago" "+%b %_d %H:%M:%S")" ' DT < $1' /var/log/messages | egrep -i "error|fail" I want to run the... (8 Replies)
Discussion started by: rahul2662
8 Replies

10. Shell Programming and Scripting

Except script to run a local shell script on remote server using root access

local script: cat > first.sh cd /tmp echo $PWD echo `whoami` cd /tmp/123 tar -cvf 789.tar 456 sleep 10 except script: cat > first #!/usr/bin/expect set ip 10.5.15.20 set user "xyz123" set password "123456" set script first.sh spawn sh -c "ssh $user@$ip bash < $script" (1 Reply)
Discussion started by: Aditya Avanth
1 Replies
netrc(4)						     Kernel Interfaces Manual							  netrc(4)

NAME
netrc: .netrc - login information for ftp, rexec, and rexec() DESCRIPTION
The file contains login and initialization information used by the autologin process, by the library routine, and by the command (see ftp(1), rexec(3N), and remsh(1)), respectively. This file is optional. It exists, if at all, in the user's home directory. If the file contains password or account information for use other than for anonymous its owner must match the effective user ID of the current process. Its read, write, and execute mode bits for group and other must all be zero, and it must be readable by its owner. Oth- erwise, the file is ignored. The file can contain the following tokens, separated by whitespace (spaces, tabs, or newlines) or commas To include a comma as part of a token, enclose that token in quotation marks (). Identify a remote machine name. The autologin process searches the file for a token that matches the remote machine specified on the command line, as an command argument, or as the parameter of Once a match is made, the subsequent tokens are processed, stopping when the end-of-file is reached or another token or a token is encountered. If the remote machine name has an alias host name, and both the official host name and the alias are present in the file, the client gives precedence to the official host name over the alias when searching the file. If an alias is given as an entry to the command, and in the search from the top of the file to the bottom, the client finds the alias host name before it finds the official host name, it will use the alias's entry. However, if it finds the official host name first, it will use the official entry even though the alias host name also exists in the file. So the high precedence given to the official host name requires placing the official host name entry last in the file for when aliases exist. Same as except that matches any name. There can be only one token, and it must be after all tokens. This is normally used for as follows: This provides automatic anonymous login to machines not specified in This can be overridden in by using the flag to disable autologin. Identify a user on the remote machine. If this token is present, the or autologin process initiates a login using the specified name. If this token matches the user name used by the command option, or, by default, the local user name, uses the token, if present. Supply a password. If this token is present, the autologin process supplies the specified string, if the remote server requires a password as part of the login process. Note that if this token is present in the file for any user other than aborts the autologin process if the is readable by anyone other than the owner. Also note that the passwords in are not encrypted. Supply an additional account password for login. If this token is present, the autologin process supplies the specified string if the remote server requires an additional account password, or the autologin process initiates an command if it does not. Define an macro. This token is just like the command. A macro is defined with the specified name; its contents begin with the next line and continue until an empty line (consecutive newline characters) is encountered. If a macro named is defined, it is automatically executed as the last step in the autologin process. EXAMPLES
The following is a valid entry for the host whose account has the password WARNINGS
It is a security risk to have unencrypted passwords in a file. AUTHOR
was developed by the University of California, Berkeley. FILES
SEE ALSO
ftp(1), remsh(1), rexec(3N). netrc(4)
All times are GMT -4. The time now is 11:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy