Remsh


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Remsh
# 1  
Old 12-20-2013
Remsh

Hello All,

I am on HP-UX.
Problem is that my remote script behaves different depending on execution method.

Method1 (Remote execution):
Code:
remsh remoteserver /home/myscript.sh

Method2 (Local execution):
Code:
remoteserver :/home#sh myscript.sh

In method 2, I can succesfully set timestamp with tee .
But method 1 doesn't work at all.

What could be the difference?
Thank you
Code:
remoteserver :/#cat /home/myscript.sh
#!/usr/bin/ksh
DATE=$(TZ=GMT date +%Y%m%d%H%M)
touch -t $DATE date_reference.file


Last edited by vbe; 12-20-2013 at 09:51 AM.. Reason: code tags
# 2  
Old 12-20-2013
Quote:
In method 2, I can succesfully set timestamp with tee .
???
For me both work...
# 3  
Old 12-20-2013
What is your default shell, VBE, mrcrowley?

I wonder if remsh is ignoring the hashbang and using a shell of its own liking...

I wonder if you've got a much newer ksh on your machine than the intended machine... Very few ksh are new enough to do date math.

Also, try set -x at the start of the script, it might be revealing.
# 4  
Old 12-20-2013
ksh...
n12 is a AIX7.1 ant is HP-UX11.11...
Code:
n12:/sm/cron/bin/wks/test $ date;remsh ant "remsh_touch_test|ll -lrt|tail -5";date
Fri Dec 20 17:07:32 CET 2013
-rw-r--r--   1 vbe        bin            442 Dec 20 14:55 cron.err
-rwxr-xr-x   1 vbe        bin             82 Dec 20 15:21 remsh_touch_test
-rw-rw-rw-   1 vbe        bin              0 Dec 20 16:07 date_reference.file
-rw-r--r--   1 vbe        bin            475 Dec 20 16:45 cron.log
-rw-r--r--   1 vbe        bin             14 Dec 20 16:45 cron.out
Fri Dec 20 17:07:33 CET 2013

the code in remsh_touch_test is the one given above
Code:
#!/usr/bin/ksh
DATE=$(TZ=GMT date +%Y%m%d%H%M)
touch -t $DATE date_reference.file

# 5  
Old 12-20-2013
Hi corona , my concern is I dont understand what tee has to do with setting timestamp in post#1 , and more with the given code...
# 6  
Old 12-20-2013
checked again, I got it now the HP box has almost no load, I have the contrary of post#1:
on remote, ( remsh first then at prompt execute...) it doesnt update...
from aix using the big command line above, it does, so its to do with multi-processing:
Code:
#!/usr/bin/ksh
DATE=$(TZ=GMT date +%Y%m%d%H%M);
touch -t $DATE date_reference.file

now it works all time... in both cases
This User Gave Thanks to vbe For This Post:
# 7  
Old 12-20-2013
Code:
ant:/home/vbe $ date;remsh_touch_test |ll -lrt|tail -7
Fri Dec 20 17:31:31 MET 2013
-rw-r--r--   1 vbe        bin            442 Dec 20 14:55 cron.err
-rw-rw-r--   1 vbe        bin              0 Dec 20 16:31 date_reference.file
-rw-r--r--   1 vbe        bin             14 Dec 20 16:45 cron.out
-rw-r--r--   1 vbe        bin            475 Dec 20 16:45 cron.log
-rwxr-xr-x   1 vbe        bin             83 Dec 20 17:19 remsh_touch_test
drwxr-xr-x  61 vbe        bin          31744 Dec 20 17:31 .
-rwx------   1 vbe        sys          29506 Dec 20 17:31 .sh_history
ant:/home/vbe $ exit
logout
Connection closed.
n12:/sm/cron/bin/wks/test $ date;remsh ant "remsh_touch_test|ll -lrt|tail -5;date"
n12:/sm/cron/bin/wks/test $ date
Fri Dec 20 17:31:57 CET 2013
n12:/sm/cron/bin/wks/test $ date
Fri Dec 20 17:32:05 CET 2013
n12:/sm/cron/bin/wks/test $ date;remsh ant "remsh_touch_test|ll -lrt|tail -5;date"
Fri Dec 20 17:32:10 CET 2013
-rw-r--r--   1 vbe        bin            442 Dec 20 14:55 cron.err
-rw-rw-r--   1 vbe        bin              0 Dec 20 16:32 date_reference.file
-rw-r--r--   1 vbe        bin            475 Dec 20 16:45 cron.log
-rw-r--r--   1 vbe        bin             14 Dec 20 16:45 cron.out
-rwxr-xr-x   1 vbe        bin             83 Dec 20 17:19 remsh_touch_test
Fri Dec 20 17:32:10 MET 2013
n12:/sm/cron/bin/wks/test $

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remsh

Hi All, Im using remsh to execute shell script on remote server. And this script gets called from another AIX server. My code is: remsh $rHost -l $rUser -n "export JAVA_HOME=/usr/java6_64_SR7; export ORACLE_HOME=/oravl01/oracle/11.1.0.7; export... (3 Replies)
Discussion started by: AB10
3 Replies

2. UNIX for Dummies Questions & Answers

remsh options

Hi All, I want to know all the options that are used for command remsh. And also the prerequisites like entries in .rhosts file. Can anybody share the link or document? thanks. (1 Reply)
Discussion started by: AB10
1 Replies

3. UNIX for Advanced & Expert Users

How To Grep Via REMSH

Well I didn't think this would be so complicated when I started it but, well, here we are. :( I'm trying to REMSH to other servers and run a grep command. Now this works just fine until the item I'm grepping for has whitespaces in it and then UNIX gets stubborn. Normally one would grep for a... (1 Reply)
Discussion started by: Korn0474
1 Replies

4. HP-UX

HPUX + remsh

Hi, I can remsh from a HPUX to a UNIX however my function keys dont then work as they should ! Any suggestions ? - have tried creating .kshrc Thanks (2 Replies)
Discussion started by: belfastbelle
2 Replies

5. Shell Programming and Scripting

remsh variables

Hi, I have script. #!/bin/sh -x CD=masterservice remsh 132.196.133.185 -l root './export $CD > test.output' rcp root@132.196.133.185:test.output But I receive the following error. + remsh 132.196.133.185 -l root ./export $CD > test.output To make it work, I remove the ' signs.... (1 Reply)
Discussion started by: mr_andrew
1 Replies

6. UNIX for Dummies Questions & Answers

remsh from HP-UX to Solaris

Hi, I have encountered a problem when I try to issue a remsh command to a remote system (Solaris). I have created the .rhost file in the home directory on the remote system and added the hostname and user. "cat .rhosts 192.168.133.26 root" But when I issue the command from the... (5 Replies)
Discussion started by: mr_andrew
5 Replies

7. HP-UX

change ip via remsh

guys,wanted to ask how tochange IP via remote. remsh is fine w/ me. but when chaging the ip it doesnt work in remsh.could you please help. # remsh server1 -l root uname -a HP-UX server1 B.11.23 U ia64 0618444750 unlimited-user license # # remsh server1 -l root ifconfig lan1 10.131.3.95... (7 Replies)
Discussion started by: kenshinhimura
7 Replies

8. Shell Programming and Scripting

how to use remsh to duplicate all...

hi , Any idea how to use remsh to duplicate whatsoever ( / ) from host1 to host2 across network with root? Regards, (0 Replies)
Discussion started by: rauphelhunter
0 Replies

9. Solaris

remsh working one way

host Solaris 5.9 E250 host-name: sunsrv1 remote Solaris 5.8 Netra 250 host_name: sspfs_svr i am able to remsh (or rsh)from remote to host like ; $ remsh sunsrv1 uname -n sunsrv1 but opposite way not possible; # remsh sspfs_svr ls sspfs_svr: Connection refused OR # rsh -l username... (2 Replies)
Discussion started by: xramm
2 Replies

10. UNIX for Dummies Questions & Answers

remsh

i m try to do remsh i need to know what are the step to define the user and password i try .rhosts it give me operator:/export/home/operator>remsh billmed ps -ef permission denied just for testing (3 Replies)
Discussion started by: kazanoova2
3 Replies
Login or Register to Ask a Question