script submitted using ssh does not return to command prompt


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting script submitted using ssh does not return to command prompt
# 1  
Old 05-11-2010
script submitted using ssh does not return to command prompt

Gurus,

I have written a shell script to backup a database and applications. This is how the script works:

1. As applications user (say applmgr), the main backup script, say backup.sh, is kicked off.

2. backup.sh does ssh to oracle user and kicks off the database backup using nohup and in the background (&).

This is where my problem is. After the backup is kicked off, the control is not being returned to the main script. Smilie

I have used both ssh and ssh -q but the problem persists.

Below are the sample scripts:

Code:
 
backup.sh
=======
 
ssh -q oracle@hostname "/u/oracle/backup_database.sh"
 
 
backup_database.sh
===============
 
nohup cp -Rp <datafile_directory> <target_directory> &


Any ideas/suggestions/tips?


Thanks in advance,


Regards,

Praveen
# 2  
Old 05-11-2010
Maybe try "ssh -n" , especially if this is a cron job.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Shell script not working but command works in command prompt

Hi everyone I have a problem with my script If I try directly this command /usr/bin/nice -n 19 mysqldump -u root --password="******" wiki_schneider -c | nice -n 19 gzip -9 > /point_de_montage/$(date '+%Y%m%d')-wiki-db.sql.gz It works But if I simply add this command in a script and... (8 Replies)
Discussion started by: picemma
8 Replies

2. Programming

Test SSH but do not return password prompt

Hello forum, I want to have a function to test for passwordless SSH setup. Pretty simple. However, what I'm finding difficult is to NOT return a password prompt to screen IF it's not in place. Here's the function: check_passwordless_ssh_working() #check passed parameter, assuming it is... (4 Replies)
Discussion started by: doonan_79
4 Replies

3. Shell Programming and Scripting

Managing awk return code over SSH command

Hello all, This bellow code works. I'm just trying to find a simplified way to achieve this. I'm sure there is an easier way and it must be to simple for me to find. Verify that the OS version is 6.1. If not exit the script. Of course if i just put a && exit 1 at the end of the ssh... (11 Replies)
Discussion started by: maverick72
11 Replies

4. Shell Programming and Scripting

ssh to remote command prompt

Hi all, Scenario - trying to run a batch job on a second machine. DIR=directory user=user server=server Here is what i have- ssh user@server 'sleep2; cd $DIR; <jobname>' I have got access to the correct directory, i checked with a pwd command previous. Problem is the job i... (1 Reply)
Discussion started by: Hopper_no1
1 Replies

5. UNIX for Dummies Questions & Answers

Command does not want to return on ssh

Hi, I am trying to use this command to backup my remote server: ssh ftp nice -19 bru -cXiAf mail-02:/dev/nst1 /etc When I run I get: connect to address 205.150.86.5 port 544: Connection refused connect to address 205.150.86.5 port 544: Connection refused trying normal rsh... (1 Reply)
Discussion started by: mojoman
1 Replies

6. Shell Programming and Scripting

How to delete the submitted at command

Hi I have submitted an at command to run next week . Now i want to remove the submitted at command . I dont want the job to run . Can anyone help me , with the command to remove the submitted at command . thanks in advance ... (3 Replies)
Discussion started by: rxg
3 Replies

7. OS X (Apple)

No command prompt after SSH/SCP

Recently whenever I log out of an SSH session, or copy something using SCP, I get no response from my shell. Running with ssh -v showed no errors when exiting. Normally I could deal with this, but I believe it's causing errors elsewhere when scripts try to download things from external... (0 Replies)
Discussion started by: keymakerOvvvv
0 Replies

8. Solaris

ssh Long time to return prompt.

Hi All, I was installed new server M5000 on solaris10. I'am try to connect to server by ssh client (putty) after type user name and password the server take long time to return prompt to me about 30-60 second. any body can suggess me how to do it. (8 Replies)
Discussion started by: cesmk
8 Replies

9. Shell Programming and Scripting

Why Does Command Run From Prompt But Not From Script?

I hope someone can shed any light on this mystery. I am trying to run the following command: su userID -c remsh server -l userid -n "awk -F^ '\$4 == \"SMITH\"' /tmp/infromational/version74b/LIVE/TEMPORARY/ABCfiles/HLC_Database_File.bat|head -1" > /tmp/variant/45BV32/var/store13.logfnd I... (15 Replies)
Discussion started by: Korn0474
15 Replies

10. Shell Programming and Scripting

Command prompt from within a script?

I am writing a menu script and one of the options is to access a Command Prompt and return to the menu via CTRL-D. I have tried using a loop and echoing the PS1 value, then using read to assign whatever is entered into a variable, then executing the value of that variable as a command using .... (1 Reply)
Discussion started by: sanitywonko
1 Replies
Login or Register to Ask a Question