Re: [Hampshire] RHEL init scripts

Top Page

Reply to this message
Author: Adrian Bridgett
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] RHEL init scripts
On Wed, Sep 3, 2008 at 17:26:43 +0100 (+0100), Samuel Penn wrote:
>
> Hi all,
>
> What is the standard way to start a process at boot time from an
> init script as a non-root user? The 'process' is a script (or,
> rather, several layers of scripts before starting Tomcat).
>
> We have tried calling the script with "sudo -u" from the init
> script, but that doesn't work during the boot process (I don't
> have more details on why, since I don't have root access to the
> box in question and can't try it myself), though if it should
> work then I can tell the admins to investigate this option some
> more.


Correct - it's in single user mode so "su" and "sudo" may not work. I
think I remember what I did (/me checks SVN) yep:
su -s /bin/sh -m $RUN_AS_USER -c "$CMD"

That "-s /bin/sh" was the magic bit IIRC.

Adrian
--
Email: adrian@??? -*- GPG key available on public key servers
Debian GNU/Linux - the maintainable distribution -*- www.debian.org