Good morning. I have tried further, but am still unsuccessful.
The echo works, but it does not execute as expected.
From what I have read on the hp.com forums, this problem could be related to the .profile of the users that I am calling to execute the commands.
http://forums13.itrc.hp.com/service/forums/questionanswer.do?admit=109447627+1242136488365+28353475&threadId=38292
According to what I have read, this could be due to the fact that the user .profile is set up to load a certain user environment, but, I'm not understanding what they mean by changing this environment.
But, I did get the ttytype error that they are talking about "not a typewriter" or something to that effect during my experiments this morning.
I have attempted
su - usera -c commanda
su - userb -c commandb
su - userc -c commandc
what I get is that it appears to logon to each user's login environment (profile, as it were) but it only appears to actually run the command one time, at the very end.
At command prompt, I type it in this way (but of course, I would not be here, unless I wanted to script this.)
I tried a do loop, but it failed.
I tried concatenating scripts with an &, and they run, but I need the su portion, in order to have the permissions on the created file work, as the apparent usera, userb, userc need some perms on the files created as a result of running the script.
Example:
commanda& commandb & commandc
This works, but there is a file(s) created, and it is under "root" and I need the files created under usera, userb, userc, respectively. I saw something about chmod 4700 in the hp.com forums, but that made no sense to me, as I know of only three digits for chmod, so the fourth digit confuses me! What is the purpose of the 4700?
Once I had attempted this, the unix admin had to go back and delete the files wherever they were creted. (He was familiar with this problem, as he had dealt with it before.)
I also tried this:
creating three separate files
filea:
su - usera
commanda
exit
fileb:
su - userb
comamndb
exit
filec:
su - userc
commandc
exit
And concatenating them together on the command line:
filea & fileb & filec
and that didn't work, it appeared to log on to each user profile, and then only executed the commands for userc.
So, I'm back where I started, SOL.