Remsh

Hello All,

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

Method1 (Remote execution):

remsh remoteserver /home/myscript.sh

Method2 (Local execution):

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

remoteserver :/#cat /home/myscript.sh
#!/usr/bin/ksh
DATE=$(TZ=GMT date +%Y%m%d%H%M)
touch -t $DATE date_reference.file

???
For me both work...

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.

ksh...
n12 is a AIX7.1 ant is HP-UX11.11...

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

#!/usr/bin/ksh
DATE=$(TZ=GMT date +%Y%m%d%H%M)
touch -t $DATE date_reference.file

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...

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:

#!/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

1 Like
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 $