There is a Unix environment named sftwrk01, uatwrk01, intwrk01 and some more

I need to check the logs in each environment everyday by login in as below (through pbsu which is a wrapper for pbrun):

$pbsu - sftwrk01  //this helps to login to sftwrk01

and then after login I check the logs. The same process goes for a few more environments like uatwrk01, intwrk01 etc.

Now I tried this:

$pbsu - sftwrk01 && cd var/can/log && ls -lrt

but this did not work because actually the statement cd var/can/log && ls -lrt was being executed after I exited from the sftwrk01 environment by typing exit.

What could be the different possible solutions considering I don't have administrator rights? (i.e I am just one of the users in the home directory.)

If this is not possible without administrator rights then you can mention a way you could do it with having full permission (perhaps you would edit the some .profile file to do that)

**OS Info :**
rcihp145 :/home/msingh2> uname -a
HP-UX rcihp145 B.11.23 U 9000/800 3683851961 unlimited-user license

Other info:

 rcihp145 :/home/msingh2> ls -lrta
 total 7296
-r--r--r--   1 msingh2    users          438 Dec 22  2010 .profile
 drw-------   2 msingh2    users           96 Dec 22  2010 .ssh
-r--r--r--   1 msingh2    users          831 Dec 22  2010 .cshrc
-r--r--r--   1 msingh2    users          347 Dec 22  2010 .exrc
-r--r--r--   1 msingh2    users          333 Dec 22  2010 .login
 -rw-------   1 msingh2    users           56 Dec 23  2010 .sh_history.
-rwxr-xr-x   1 msingh2    users         5451 Dec 23  2010 .dtprofile
 -rw-------   1 msingh2    users      3577932 May 18 05:21 core
drwxr-xr-x  422 root       root         16384 Aug  3 14:27 ..
-rw-------   1 msingh2    users          245 Aug  4 00:41 .Xauthority
-rw-------   1 msingh2    users         1768 Aug  4 00:41 .TTauthority
drwxr-xr-x   4 msingh2    users         8192 Aug  4 00:41 .
 -rw-------   1 msingh2    users        37533 Aug  4 00:41 .ICEauthority
 -rw-------   1 msingh2    users         4064 Aug  4 06:28 .sh_history
 drwxr-xr-x  12 msingh2    users         8192 Aug  4 06:28 .dt
 -rw-------   1 msingh2    users         3462 Aug  5 02:29 .sh_history.msingh2
link|improve this question

80% accept rate
please migrate this question to unix site if it is not a best fit here for an answer – munish Aug 5 '11 at 6:27
what is $pbsu - sftwrk01 exactly? Is $pbsu a command that takes - and sftwrk01 as arguments? Whatever it is, if it runs a login shell you could put ls -lrt var/can/log in your .profile on sftwrk01. – jw013 Aug 5 '11 at 6:33
yes pbsu is a command that takes - and sftwrk01 as arguments, thanks for your suggestion – munish Aug 5 '11 at 6:36
This question should go to unix or serverfault – hmontoliu Aug 5 '11 at 8:34
can it be moved there ? how....Thanks a lot for your patience anyway @hmontoliu – munish Aug 5 '11 at 9:48
show 1 more comment
feedback

closed as off topic by DMA57361 Aug 5 '11 at 10:54

Questions on Super User are expected to generally relate to computer software or computer hardware, within the scope defined in the faq.

1 Answer

Check the following post:

http://serverfault.com/questions/266379/how-to-rename-a-remote-file-on-linux-with-script/266381#266381

It shows a good way to run multiple commands in multiple remote servers through ssh. Adapt it to your needs.

And for your question: tell us what is pbsu or use ssh directly

HTH

EDITED: this question is about pbrun as arises from the comments in this answer - so I can't help you; I've edited your question (review pending) to reflect that fact.

link|improve this answer
ssh does not work for login into sftwrk01, intwrk01 etc ..perhaps pbsu is configured to do that and it(pbsu) does not ask for any password also, and just straightaway logs in after doing pbsu - sftwrk01 – munish Aug 5 '11 at 6:59
Let me insist: if you want us to help you, you'll need to tell us what is pbsu or how it works. My guess is that it is just a wrapper for ssh (or telnet -- I hope not!) that just sets the port and maybe the file with the rsa/dsa keys so you don't have to worry about those details. However to understand why you can't execute batch commands in the remote servers, we need to know how do you connect to them. At least tell us what does "file $(which pbsu)" returns and if it is a shell script open it and take a look. – hmontoliu Aug 5 '11 at 7:31
it returned as follows : $ file $(which pbsu) /usr/local/bin/pbsu: commands text – munish Aug 5 '11 at 7:52
sorry for being late buddy, I found what pbsu is here it is – munish Aug 5 '11 at 7:58
perhaps it adds more complexity to the question – munish Aug 5 '11 at 8:04
show 1 more comment
feedback

Not the answer you're looking for? Browse other questions tagged or ask your own question.