Gentoo Archives: gentoo-user

From: "Wang
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] /etc/init.d/hwclock & /etc/init.d/ntp-client failed to start due to service dependency problem?
Date: Fri, 05 Sep 2008 08:20:12
Message-Id: 1220602807.32291.9.camel@wangbj-hp6515b
In Reply to: Re: [gentoo-user] /etc/init.d/hwclock & /etc/init.d/ntp-client failed to start due to service dependency problem? by Neil Bothwick
1 在 2008-09-05五的 09:07 +0100,Neil Bothwick写道:
2 > On Fri, 05 Sep 2008 10:24:25 +0800, Wang, Baojun wrote:
3 >
4 > > depend section of /etc/init.d/hwclock, there is a line
5 > >
6 > > before *
7 > >
8 > > thus hwclock will start before modules (where I put rtc-cmos
9 > > in /etc/conf.d/modules), so it will always fail to ajust hwclock.
10 >
11 > Build it into the kernel. There's usually not much point in building
12 > something as a module if you're going to load it every time you boot,
13 > unless you want to pass it options.
14 >
15 > > Besides, I'm using networkmanager (using gnome nm-applet) , so there
16 > > is no /etc/init.d/net.eth* stuff, but ntp-client have a section of
17 > >
18 > > need net
19 > >
20 > > but at that time when ntp-client start, there is no network avaliable (I
21 > > always get error will unable to reslove hostname XXX, so at least DNS is
22 > > not usable at that time, even I put after NetworkManager
23 > > in /etc/init.d/ntp-client).
24 >
25 > Programs lime this and nfsmount should be started by NetworkManager's
26 > Dispatcher so they start when a network interface comes up. This is how I
27 > do it.
28 >
29 > [nelz@krikkit ~ 0]% ls -l /etc/NetworkManager/dispatcher.d
30 > total 4
31 > lrwxrwxrwx 1 root root 10 2008-05-07 12:45 20-netmount -> default.sh
32 > lrwxrwxrwx 1 root root 10 2008-05-07 12:45 30-nfsmount -> default.sh
33 > lrwxrwxrwx 1 root root 10 2008-05-07 12:45 50-ntp-client -> default.sh
34 > lrwxrwxrwx 1 root root 10 2008-05-07 12:45 70-ntpd -> default.sh
35 > -rwxr-xr-x 1 root root 256 2008-05-07 12:51 default.sh
36 >
37 > [nelz@krikkit ~ 0]% cat /etc/NetworkManager/dispatcher.d/default.sh
38 > #!/bin/sh
39 >
40 > service=$(basename $0 | cut -c4-)
41 > [[ -e /etc/init.d/$service ]] || exit 0
42 >
43 > if [[ "$2" == "up" ]] ; then
44 > /etc/init.d/$service --quiet status || /etc/init.d/$service start
45 > else
46 > /etc/init.d/$service --quiet status && /etc/init.d/$service stop
47 > fi
48 >
49 Thanks very much Neil, that's exactly what I need!
50 --
51 Wang, Baojun Lanzhou University
52 Distributed & Embedded System Lab http://dslab.lzu.edu.cn
53 School of Information Science and Engeneering wangbj@×××××××××××××.cn
54 Tianshui South Road 222. Lanzhou 730000 .P.R.China
55 Tel: +86-931-8912025 Fax: +86-931-8912022

Attachments

File name MIME type
signature.asc application/pgp-signature