Automating pbrun /bin/su not working, whenever manually it is working using putty

I am trying to automate a script where I need to use

pbrun /bin/su

but for some reason it is not passing thru the

pbrun 

as my code below.

. ~/.bash_profile
pbrun /bin/su - content
c h 1
hpsvn up file path

I am executing this from an external .sh file that is pointing to this scripts file but it is not running, if I do it in putty manually mode it works but if I run it from automate script it is not working, There is a difference between the

$PATH

but I don't know what relation does that has with the problem.

What do you mean by "automate"? Starting/running scripts via cron ? Then you need to explicitly define the PATH variable so all the needed paths are available.
Any error msgs, by the way?

By automating, I am referring to instead of typing manually, everything will be read from an external file, I have an .sh file that connects to the server with the usr and password and read the scripts from an .txt file that I have.

Once my putty window prompts once I start this automation scripts, it just freeze after executing pbrun /bin/su without continue reading my commands script or even allowing to type other command manually, even it isn't showing any errors on the window.

How can I define the $PATH from my external script? the difference between my paths are

manually opening putty and typing

echo $PATH
/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/axphome/jjacome/bin:/amex/bin:/amex/bin/GenSync

typing echo $PATH from the external file that opens putty

/usr/local/bin:/bin:/usr/bin:/axphome/jjacome/bin:/amex/bin:/amex/bin/GenSync

Does this difference is the error of why it is not proceeding?

Not clear. What's an external file? Where is it located? Where are those .sh and .txt files located? Please post mode details.

So I have a .bat file that will connect to putty and execute the scripts in the path Documents\Heroes\e1_scripts.txt.

ssh.cmd
@echo on
cd C:\Users\jjaco23\Desktop
putty.exe -ssh ipaddress -l user -pw password -m C:\Users\jjaco23\Documents\Heroes\e1_scripts.txt

In the file e1_scripts.txt

. ~/.bash_profile
pbrun /bin/su - content <----Getting freeze in here
c h 1
hpsvn up file.html

I am just executing svn commands that I want instead of doing it manually to be executed from this external file. If I type manually in putty all this commands it works fine but whenever I execute from this .bat file and reading the scripts file, it is getting stop in the line

pbrun /bin/su - content

without proceeding with the next line.

I researched a little bit by looking that the $PATH variable if I run it manually opening putty is different than being executed from this external .bat file.

Hopefully I was more clear this time.

From the putty documentation:

Did you consider using plink (from the putty family)?

Can't due software approval restrictions.

So as I am understanding the -m is not allowing to proceed due my server, but why I am able to run it manually in putty but not from the .bat file.

---------- Post updated 12-01-15 at 09:30 AM ---------- Previous update was 11-30-15 at 12:16 PM ----------

My issue is similar to this other thread

"I have a script, which pbruns into another account.
I want to pbrun run into that account, and continue running all the commands in my script.
But instead, it pbruns into the account, and just gives me a shell prompt.. and stops there.
Only once i exit that shell prompt.. does it continue running the rest of the sciprt."

No further solutions that works for the moment.

After the pbrun is executed it is getting stuck without proceeding.

Is it possible that you are at the (invisible) interactive prompt? Try entering a command. Try exiting the interactive process. Does it continue the script, then?

I already try it but it is stuck in there, I read in another post in this forum

"When you pbrun into a different account a new login script is executed because of which it waits for at the command prompt. The commands in your main script will be executed after you manually exit from this login script."

I am trying to find a solution for this, seems that the thread for pbrun gets stuck in that task until you exit the prompt manually.

Wouldn't the -c option to su work?

I don't get it how the su can work here, instead of pbrun /bin/su - content , do su -c - content ? I am not familiar with the su for this case

man su is your friend.

Not sure if this would work with pbrun:

/bin/su -c $(pwd)/TMP.sh - content

with

cat TMP.sh
c h 1
hpsvn up file.html

Didn't work with pbrun, and I have my hands tight, I don't have privileges to use man su cause company policies....any other work around? :confused:

Did you consider the man pages at the top of this page (unix.com)?

Yea, I will have this on pending cause the man commands I can't use it due admin restrictions with my user