- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Shell scripting
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2005 10:06 PM
02-14-2005 10:06 PM
Shell scripting
I'm programming a shell Script To start and stop an application.
my problem is that to execute some applications I have to change the user and load his Environment parameters.
using su -
where doing su - in the script
unix changes the user and stop running the scrip.
So I need your help because I'm learning shell scripting.
I'm working with hp-ux 11.11
Thanks for your help !!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2005 10:21 PM
02-14-2005 10:21 PM
Re: Shell scripting
try the following in your script.
#nohup
This allows the command to be keep ruuning even after after changing the session.
If you can post your script then people can modify that in a better way. post it if you dont mind.
Regards,
Syam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2005 02:03 AM
02-15-2005 02:03 AM
Re: Shell scripting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2005 05:05 AM
02-15-2005 05:05 AM
Re: Shell scripting
su user -c 'command'
I think this will solve the issue as the parameters will possibly get wiped by a full login, unless there's really really many.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2005 08:01 AM
02-15-2005 08:01 AM
Re: Shell scripting
Have you tried loading the environment variables into the script of the user who you are trying to do a su - on?
I would also try as suggested above, trying to do a manual su -
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2005 10:11 AM
02-15-2005 10:11 AM
Re: Shell scripting
#!/usr/bin/sh
echo Running this as "root"
su otheruser <
. ~otheruser/.profile
echo I now have my env variables like otheruser
...
EOF
This way even though a new shell is started for the new "su" user, it will continue to read in the script from the file. Using "." will source in the .profile.
You can now run applications (for the most part) like you were "otheruser"
HTH
-- Rod Hills