[CLUE-Tech] set user id of script

Jed S. Baer thag at frii.com
Thu Jun 6 12:24:16 MDT 2002


On Thu, 06 Jun 2002 12:05:34 -0600
Lynn Danielson <lynnd at techangle.com> wrote:

> Dave Price wrote:
> > 
> > Is there a 'nice' way to execute a line in a script (or a script at
> > startup under the priveleges of another user ... 
> > 
> > I need to run some oracle scripts as different oracle uids which have
> > appropriate priveleges ...
> 
> You can add inittab entries for the appropriate runlevel(s) and have
> init execute the script via su, e.g.,
> 
> o1:35:wait:/sbin/su - oracle_user1 -c /absolute_path_to/script1
> >/dev/null 2>1
> 
> An entry like this would execute script1 for runlevels 3 and 5 at
> startup.  The nice thing about using init to kick off processes,
> is that if you want the script running all the time, you can use
> the respawn directive in the third field.  Then if the script ever
> dies, init will automatically restart it.

Whew. The real "down at the bare metal" approach. ;-) I'd have to think
long and hard, though, about using the respawn for Oracle's processes. I
mean, if it did go down, I'd be wanting to look first before restarting
it. Some other interesting things you can do with Oracle, like a daemon
running named pipes for external processing and communicating with
database processes, yeah those I'd maybe respawn.

Also, I wouldn't send output to /dev/null. If there are failures, I like
to see the error messages. So what I do is, as the first line in the
script being spawned:

  exec > /path/to/logfile 2&>1

You can also use ">>" for appending if you want.

jed

-- 
We're frogs who are getting boiled in a pot full of single-character
morphemes, and we don't notice. - Larry Wall; Perl6, Apocalypse 5



More information about the clue-tech mailing list