- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Command run under 'su' doesn't work right
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
Discussions
Discussions
Forums
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
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
тАО12-12-2003 06:50 AM
тАО12-12-2003 06:50 AM
$ /jv77/cognos/cer3/bin/configcp -t /jv77/cognos/cer3/bin/start.ccp
It runs as it should.
When I run it this way logged in as root:
su -cognos -c "/jv77/cognos/cer3/bin/configcp -t /jv77/cognos/cer3/bin/start.ccp"
It gives me errors that certain files can't be found. Does this -c actually invoke the cognos user's profile? It seems paths aren't being established, or that it's using root's path, etc....
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-12-2003 06:53 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-12-2003 06:54 AM
тАО12-12-2003 06:54 AM
Re: Command run under 'su' doesn't work right
Try this:
su -cognos
env
then
su -cognos -c env
Different?
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-12-2003 06:59 AM
тАО12-12-2003 06:59 AM
Re: Command run under 'su' doesn't work right
su - cognos -i -c "/jv77/cognos/cer3/bin/configcp -t /jv77/cognos/cer3/bin/start.ccp"
That will run the shell in interactive mode.
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-12-2003 06:59 AM
тАО12-12-2003 06:59 AM
Re: Command run under 'su' doesn't work right
Try this:
su - cognos -c '/jv77/cognos/cer3/bin/configcp -t /jv77/cognos/cer3/bin/start.ccp'
Note the spacing and 'quote' change.
D
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-12-2003 07:39 AM
тАО12-12-2003 07:39 AM
Re: Command run under 'su' doesn't work right
This is a very common problem. As others mentioned, most often it involves env variables.
In out shop we are accustomed to place exports of the required environment variables in the script to be executed.
Having done this, we seldom encounter any errors.
Yes, this means acouple of export XXX="YYY" in your script to execute, but it sure relieves some headaches.
Regards,
dl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-12-2003 07:55 AM
тАО12-12-2003 07:55 AM
Re: Command run under 'su' doesn't work right
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-12-2003 08:09 AM
тАО12-12-2003 08:09 AM
Re: Command run under 'su' doesn't work right
what wonders me is, it should have complained about an invalid option since there is no space after the -. Probably he does interpret this as additional command and tries to run it as root. If you put a command on two lines, you will have to use a continuation character, so the two lines will be interpreted as one and I think it is the \, you will have to use at the end of line one. But still the su - cognos should work. It will read the .profile and execute the command.
greetings,
Michael