Gentoo Archives: gentoo-user

From: Grant <emailgrant@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Starting a daemon automatically without rc-update
Date: Wed, 12 Aug 2009 23:53:31
Message-Id: 49bf44f10908121653i404d74acla048ccf31ba5dea1@mail.gmail.com
In Reply to: Re: [gentoo-user] Starting a daemon automatically without rc-update by Neil Bothwick
1 >> I run one program which needs to be started as a particular user
2 >> whenever the system comes up, but there is no ebuild.  Is this the
3 >> Gentoo way?
4 >>
5 >> # cat /etc/init.d/rc.local
6 >> #!/sbin/runscript
7 >>
8 >> start() {
9 >> su user
10 >> /path/to/program/binary
11 >> }
12 >
13 > Yes, or you could use
14 >
15 > start() {
16 >  su - user -c /path/to/program/binary
17 > }
18 >
19 > which runs the program with the user's full environment instead of
20 > inheriting root's.
21 >
22 >
23 > --
24 > Neil Bothwick
25
26 Hmmm, it didn't come back up with the server. I have this in
27 /etc/init.d/rc.local:
28
29 #!/sbin/runscript
30 depend() {
31 }
32 start() {
33 su - user -c /path/to/binary
34 }
35 stop() {
36 }
37 restart() {
38 }
39
40 I had to start it like I normally do instead:
41
42 # su - user
43 $ /path/to/binary
44
45 What could I be missing?
46
47 - Grant

Replies

Subject Author
Re: [gentoo-user] Starting a daemon automatically without rc-update Neil Bothwick <neil@××××××××××.uk>
[gentoo-user] Re: Starting a daemon automatically without rc-update Nikos Chantziaras <realnc@×××××.de>