shell scripting problems involving operations with remote machine
Hi,
i have been developing a shell script to transfer a set of files from one ubuntu system to another.
Task: while executing the script the files ( ls, dir, cat) in the source machine should transfer to destination machine(at /home/mac/mac/bin)
While the script is executed once again, It should create a backup file( bacup_date_time) and move all the old files in destination machine(at /home/mac/mac/bin) ti this backup file.
Here is the code i tried with,
My problem is I am able to run this script, but the backup files are not created.
I can see the files getting transfered, but I am not able to make a new backup directory and also copy the old files in remote machine.
please help me on this.
Thanks in advance
---------- Post updated at 12:54 PM ---------- Previous update was at 12:05 PM ----------
Don't mind, I got self help and the problem is solved by adding "here document" concept
I want to execute a shell script(set of commands) on remote machine and that script takes input from text file(local machine). Please refer below:
ssh user@hostname 'bash -s'< ./test.sh file.txt
But i got the error file.txt doesn't exist.
Can anyone help me on this.
Content of test.sh:
... (2 Replies)
Hi All,
We have 2 servers A and B.
B is having a sctipt called b.sh in path /home/dev/scripts.
Now my requirement is i want to execute b.sh from server A.
Kindly help me. (3 Replies)
I'm in a situation where I am executing a shell script(Bash) on another machine remotely using ssh, and for various reasons sometimes need to quit it and restart it. The shell script being run does many different things, so its hard to know what process to kill on the remote machine, and even if I... (2 Replies)
how to use ssh to run shell script on a remote machine?
ssh user@remote sh ./script.unx
i ran the above command
./script.unx HAS NOHUP COMMAND IN ITS BODY, I AM GETTING ERROR AS NOHUP NOT FOUND...
i tried to run that script from remote server, its working fine
do ineed to set... (6 Replies)
Hi All,
i have two machines like x and y . my requirement is i should connect to machine Y from x through ssh connection . and do some operation such as copy and move and delete files in Y machine .
i tried with this code but it is doing in machine x only . and i need to exit from Y when... (1 Reply)
Day before yesterday,I got the success creating a shell script using expect tool and now it is running successfully on the server.
Now I want to make some changes in paswwordchanger.sh as you can see it can handle only one user i.e dbaguest and not other user.So I am thinking the logic how I can... (0 Replies)
Hello all-
I have done a lot of searching tonight, but all leads seem to be dead ends. Forgive me if this has been covered, but I've searched the forum and the internet. I am having trouble building a shell script which uses SSH to login to our schools 1024 cluster grid. The issue that I am... (1 Reply)
Hi,
I have written a shell script for oracle on unix that does a df for specific files, and then will display the size, Avail, % used and the difference from yesterday to today.
I have been asked to place it on some MySql databases that run onn unix and linux also, but when I try to run them I... (2 Replies)
hi All,
my query...
1.I Have to search for the files in the root directory.
2.i have to search for a pattern in all the files in the root directory and then replace them with a new pattern.
3.Rename the file
Explanation:
if ABC is the root folder and has 3 subfolders and there are 15... (9 Replies)
Hi,
I am trying to set environment variable on a remote machine. I want to do it by running a shell script
Here's what I am doin
rsh <remote-hostname> -l root "cd /opt/newclient; . ./setp.sh"
In setp.sh, I have
#############################
cd ../newlib;
export... (1 Reply)