- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Starting a process at boot that is owned by a user...
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
10-05-2001 05:04 AM
10-05-2001 05:04 AM
Starting a process at boot that is owned by a user, not root
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2001 09:35 AM
10-05-2001 09:35 AM
Re: Starting a process at boot that is owned by a user, not root
su - user_name -c "/path/command"
I've seen some posts in the hp-ux forum for this, here's one that should work;
http://forums.itrc.hp.com/cm/QuestionAnswer/1,11866,0x58f8660142b2d5118ff10090279cd0f9,00.html
Hope this helps
-denver
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2001 01:47 PM
10-05-2001 01:47 PM
Re: Starting a process at boot that is owned by a user, not root
As Denver has already pointed out, to run a particular command as a user while booting you should put
su - user_name -c "/path_to_command/command"
in the startup file. You can put this command in /sbin/rc2.d directory with a Sxxxsome_name, where xxx is a three digit number.
Try to run this command after loggging in as root user to see that the command doesn't return asking you for an option. When you do su - user_name it will execute the profile of that user and sometimes it asks you to enter the terminal type (say hp or vt100 or hpterm). To avoid the system asking you this terminal type, export the terminal type in the user .profile and put a "#" in front of the terminal type evaluation script (eval tset ....). instead export the terminal type for that user. put "export TERM=terminal_type" in the .profile for that user.
Hope this helps.
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2001 12:41 PM
10-08-2001 12:41 PM
Re: Starting a process at boot that is owned by a user, not root
The one problem you may encounter with the su - user command is the execution of the user's .profile. If you simply execute it as su user command then the user's .profile is not executed. .profiles often fail because some of the commands like stty and tabs expect a terminal device which you will not have when started from rc. If you must execute the .profile to set up the environment, modify the .profile something like this:
if [ -t 0 ]
then
stty ....
tabs
fi
This will bypass the commands when stdin (0) is not a terminal device.
Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2001 06:45 PM
10-08-2001 06:45 PM
Re: Starting a process at boot that is owned by a user, not root
When you create your start/stop script try copying one of the existing scripts in the /sbin/init.d directory and use that as a template to creating your script (cron is a fairly simple script). Depending on the nature of the process you need to start, the script should include a start section and a stop section.
Save the script in the /sbin/init.d directory with the permissions rx for all and bin as owner and group. From the /sbin/rcX.d directories create a sym link to the /sbin/init.d script to stop and start the script.
ie, To start non-root processes I create a sym link in the /sbin/rc3.d directory, eg /sbin/rc3.d/S900oracle -> /sbin/init.d/oracle (default runlevel is 3) and to stop them I create a sym link in /sbin/rc2.d, eg /sbin/rc2.d/K001oracle -> /sbin/init.d/oracle.
Try to start your non-root processes last in the boot sequence (ie, at runlevel 3 - if that is the default runlevel on your system). Having them start before some root processes may cause you problems if the non-root process fails to start properly.
There is also a way of disabling the start/stop scripts via way of a simple text file kept in the /etc/rc.config.d directory. Again look at the cron entry as an example. Simply put, if the entry in this file is a 1 (ie, CRON=1) then allow cron to start and stop during startup and shutdown. If it is a anything else (ie, CRON=0) then cron will neither start or stop (of course, if you are rebooting the system it will stop cron anyway). This is particularly useful if you are patching or diagnosing a system and you don't want the non-root process starting up after reboots.
Cheers,
Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2001 07:38 PM
10-08-2001 07:38 PM
Re: Starting a process at boot that is owned by a user, not root
You need to club all the suggestions made by the above to get yours working.
1)Script in /sbin/init.d
2)Links from /etc/rc?.d/ as Kxxxscript Sxxxscript.The best choice for rc directory is the highest run level that your systems runs in finally.
3)/etc/rc.config.d/ flag script called from the script that is there in /sbin/init.d - But this is completely optional but gives better control.
4) In your script in /sbin/init.d you need to use su - user_name command to get the commands executed as the user_name.
For ex. a template of the script would look like this. You can take any script in /sbin/init.d and modify it
#!/usr/bin/sh
case $1 in
start) su - oracle -c /home/oracle/bin/dbstart
;;
stop) su - oracle -c /home/oracle/bin/dbshut
;;
*) echo "Usage: $0 start stop
;;
esac
#ln -s /sbin/init.d/oracle /sbin/rc3.d/S990oracle
#ln -s /sbin/init.d/oracle /sbin/rc3.d/K990oracle
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2001 01:21 PM
10-10-2001 01:21 PM
Re: Starting a process at boot that is owned by a user, not root
I would love to assign point here.
My problem is solved without posting any question.
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2001 01:25 PM
10-10-2001 01:25 PM
Re: Starting a process at boot that is owned by a user, not root
If you loved to assign the points, post the same question, we will copy&paste the answers. Your love would be fruitful
:-{)
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2001 02:25 PM
10-10-2001 02:25 PM
Re: Starting a process at boot that is owned by a user, not root
No fun, No excitement because I know what is going to be my answer.
Sachin
And who is going to answer. LOL :))
Sachin