![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| problem with dd command or maybe AFS problem | Anta | Shell Programming and Scripting | 0 | 08-25-2006 07:10 AM |
| SSH Problem auth problem | budrito | UNIX for Advanced & Expert Users | 1 | 03-17-2004 07:12 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
rsh problem
Hi,
I am using rsh command in scripting. But I wan to run the script as a bg process. When I run the script, it says stopped. My doubt is .if I use the rsh in scripting bg is possible or not ??? EX: test-rsh rsh 172.16.73.38 df k >DF.log Result when I run this script root@FRAPRB2BADE1 # nohup ksh test-rsh & Sending output to nohup.out [1] 24994 root@FRAPRB2BADE1 # [1]+ Stopped nohup ksh test-rsh root@FRAPRB2BADE1 # The process will not run as bg?? Waiting for your replay ------ vastare |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
rsh problem
Hi,
no one is there to answer for this question ??????? its very urgent.....please help me out. ------------ vastare |
|
#3
|
||||
|
||||
|
first off --- forum rules says you're not suppose to bump up questions so you broke this rule by putting in your second post on this thread ...
second, your test-rsh is not accurate because the "df -k" command you are giving terminates immediately after it gives you a one-time output ... try testing with a "ls -l /dir/file" loop instead ... if your result still disallows you putting the rsh job in the background, try the code below ... run the rsh command in the background inside a sub-shell ... Code:
(rsh servername "jobname" < /dev/null > /dir/file 2>&1 &) |
|
#4
|
|||
|
|||
|
Hello,
Sorry for the second post on this thread ... I explained every steps here 1. script root@FRAPRB2BADE1 # cat test-rsh #!/usr/bin/ksh rsh 172.16.73.38 ls -l 2>>test.log 2. run the script as background processes root@FRAPRB2BADE1 # nohup ksh test-rsh & Sending output to nohup.out [1] 6476 root@FRAPRB2BADE1 # [1]+ Stopped nohup ksh test-rsh 3. grep the process root@FRAPRB2BADE1 # ps -ef | grep test-rsh root 6476 6431 0 17:37:50 pts/2 0:00 ksh test-rsh 4. type exit root@FRAPRB2BADE1 # exit exit There are stopped jobs. 5. grep the process root@FRAPRB2BADE1 # ps -ef | grep test-rsh root 6476 6431 0 17:37:50 pts/2 0:00 ksh test-rsh root@FRAPRB2BADE1 # exit exit There are stopped jobs. 6. grep the process root@FRAPRB2BADE1 # ps -ef | grep test-rsh root 6476 6431 0 17:37:50 pts/2 0:00 ksh test-rsh root@FRAPRB2BADE1 # exit exit 7. grep the process root@FRAPRB2BADE1 # ps -ef | grep test-rsh root@FRAPRB2BADE1 # When i grep the process in the last statement....nothing is showing?? I want to know the root cause for this... Please help me .. Its very interesting to know the reason ------------- vastare |
|
#5
|
||||
|
||||
|
your test is still terminating after the lone "ls -l" call ... you need to create a script that runs a command loop (see below) and then copy that over to the remote server and then test with that ...
Code:
while true
do
ls -l /dir/file
done
|
|
#6
|
|||
|
|||
|
rsh problem
Hi,
Thank you, very much.... The rsh problem is solved. If you want to run the rsh in a bcakground, use -n option with the rsh command. Here is the proper syntax to use the rsh (remote shell) command without having the remote shell remain active until the remote command is completed. rsh -n machine 'command >&/dev/null </dev/null &' Where machine is the name of the remote computer and command is the remote command to be performed. This works because the -n flag attaches the rsh's standard input to /dev/null so you can execute the complete rsh command in the background of the local computer. Also, the input/output redirections on the remote computer (the stuff inside the single quotes) makes rsh think the session can be terminated since there is no data flow. In all truth, you don't have to use /dev/null. Any filename will work. Ex: while true do #rsh -n remote-IP command >>logfile rsh -n 172.16.73.26 ls -l >>remote.log done ------------- vastare |
|||
| Google The UNIX and Linux Forums |