- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Can i execute su command in pkg.cntl file cluster
Operating System - HP-UX
1753872
Members
7186
Online
108809
Solutions
Forums
Categories
Company
Local Language
юдл
back
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
юдл
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
тАО07-23-2004 08:59 AM
тАО07-23-2004 08:59 AM
Can i execute su command in pkg.cntl file cluster
I need to execute: su - root -c script_name to turn on a aplication form pkg.cntl.
Is possible to do su - root in pkg.cntl?
Thanks
Is possible to do su - root in pkg.cntl?
Thanks
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2004 09:12 AM
тАО07-23-2004 09:12 AM
Re: Can i execute su command in pkg.cntl file cluster
your serviceguard start/stop scripts already run with root id unless there is something really funky setup on your server. Hence you do not need to su - root anywhere in your script.
if need be, you can do things like
su - oracle -c script_name
to inherit the environment variables of oracle and have the processes started have the oracle user ownership, but su - root, is something I have never heard of or seen.
if need be, you can do things like
su - oracle -c script_name
to inherit the environment variables of oracle and have the processes started have the oracle user ownership, but su - root, is something I have never heard of or seen.
________________________________
UNIX because I majored in cryptology...
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2004 09:21 AM
тАО07-23-2004 09:21 AM
Re: Can i execute su command in pkg.cntl file cluster
Sure you can do su - root inside the package control script.
Under normal circumstances, as Mel has mentioned, you dont have to su - root and execute the binary since the script itself is executed with root privileges.
But if the binary/script is dependent on some variable that is set by the root's .profile , then you can use su - root.
Under normal circumstances, as Mel has mentioned, you dont have to su - root and execute the binary since the script itself is executed with root privileges.
But if the binary/script is dependent on some variable that is set by the root's .profile , then you can use su - root.
Learn What to do ,How to do and more importantly When to do ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2004 09:38 AM
тАО07-23-2004 09:38 AM
Re: Can i execute su command in pkg.cntl file cluster
Be very careful doing su - user commands in a non-interactive environment. Most default .profiles expect to be running with a TTY input device and commands like tset, tput, tabs ... can hang or fail. There are two approaches, 1) surround any commands in the .profile with
if [ -t 0 ]
then
tset
tabs
fi
OR
create a script file which sets and exports any needed variables and let both the .profile and any scripts source the file, e.g. myenv.sh using the "." (dot) command.
. /usr/local/bin/myenv.sh
In this case you would use su user rather than su su - user. The sourced file must not contain an exit or return because it is actually part of the foreground process.
In any event, it should never be necessary to do an su root in a package.
if [ -t 0 ]
then
tset
tabs
fi
OR
create a script file which sets and exports any needed variables and let both the .profile and any scripts source the file, e.g. myenv.sh using the "." (dot) command.
. /usr/local/bin/myenv.sh
In this case you would use su user rather than su su - user. The sourced file must not contain an exit or return because it is actually part of the foreground process.
In any event, it should never be necessary to do an su root in a package.
If it ain't broke, I can fix that.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP