1 |
Hi, |
2 |
|
3 |
I'm new to Gentoo and I'm trying to convert the RedHat init script for OpenVPN |
4 |
over to Gentoo's format. Though I'm still learning the Gentoo way of writing |
5 |
init scripts, I would like to suggest the following additions to runscript.sh: |
6 |
|
7 |
(1) There should be an easy-to-call support function so an init script can |
8 |
tell whether or not it has been started such as: |
9 |
|
10 |
started() { |
11 |
if [ -L "${svcdir}/started/${myservice}" ]; then |
12 |
return 1 |
13 |
else |
14 |
return 0 |
15 |
fi |
16 |
} |
17 |
|
18 |
This way, init scripts can easily tell if they are loaded, prior to doing |
19 |
things like sending signals to daemons. |
20 |
|
21 |
(2) Condrestart is a useful init script method, often seen in RH init scripts. |
22 |
It basically says "restart only if service is already running". It is |
23 |
commonly used to restart a daemon after a software update. OpenVPN needs it |
24 |
so that the VPN daemon can be restarted if a network adaptor gets a new IP |
25 |
address from a DHCP server. In cases like these, you obviously don't want to |
26 |
restart the daemon unless it is already running. Condrestart becomes |
27 |
breathtakingly simple if started() above is defined: |
28 |
|
29 |
condrestart() { |
30 |
started || restart |
31 |
} |
32 |
|
33 |
If there are better ways of doing these things in Gentoo, please let me know. |
34 |
Otherwise, I can send a formal patch of my changes to runscript.sh |
35 |
|
36 |
Thanks, |
37 |
|
38 |
James Yonan |
39 |
|
40 |
|
41 |
-- |
42 |
gentoo-dev@g.o mailing list |