diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2011-05-16 21:57:21 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-05-18 14:32:45 +0100 |
commit | ffef4dad894a6c8401ea0409936f52fe8e333fb2 (patch) | |
tree | ed4b3861494446ba42e1a8fafe9c629811c2aa51 /meta-skeleton/recipes-skeleton/service/service_0.1.bb | |
parent | 0424560e5fb00ad5e455af82425143d87a37bcc7 (diff) | |
download | poky-ffef4dad894a6c8401ea0409936f52fe8e333fb2.tar.gz |
Add a skeleton for init scripts
Add a skeleton for init scripts, the original structure is from
/etc/init.d/skeleton of Ubuntu 10.10, it is in sysvinit_2.87dsf, so add
the COPYRIGHT(GPLv2) of sysvinit_2.87dsf. Modified the original skeleton
a lot to make it as easy as possible, just use posix shell command, and
have tested it with core-image-minimal.
* The skeleton implements the following actions:
- start, stop, restart, status, try-restart and force-reload.
# force-reload is a alias of try-restart.
- not implements reload, since only a few programs have it, just leave
it as placeholder.
* Add /usr/sbin/skeleton-test to test /etc/init.d/skeleton
* The /etc/init.d/skeleton can be run and output the example messages:
1) #./skeleton start (test start)
Starting skeleton ...
2) #./skeleton start (test start again when running)
skeleton already running (1078).
3) #./skeleton status (test status when running)
skeleton is running (1078).
4) #./skeleton stop (test stop)
Stopped skeleton (1078).
5) #./skeleton stop (test stop again)
skeleton is not running; none killed.
6) #./skeleton status (test status when stopped)
skeleton is not running.
7) #./skeleton restart (test restart when running)
Stopped skeleton (1128).
Starting skeleton ...
8) #./skeleton restart (test restart when stopped)
skeleton is not running; none killed.
Starting skeleton ...
9) try-restart (or force-reload) means restart the service if the
service is already running
#./skeleton try-restart (test try-restart when stopped)
skeleton is not running; none killed.
#./skeleton try-restart (test try-restart when running)
Stopped skeleton (1181).
Starting skeleton ...
* Have used syslogd to test it in a real world(with both
core-image-minimal and core-image-sato)
(From OE-Core rev: c1b6f840ad7c483e905f9a19eb2b5a8eac0b9973)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta-skeleton/recipes-skeleton/service/service_0.1.bb')
-rw-r--r-- | meta-skeleton/recipes-skeleton/service/service_0.1.bb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/meta-skeleton/recipes-skeleton/service/service_0.1.bb b/meta-skeleton/recipes-skeleton/service/service_0.1.bb new file mode 100644 index 0000000000..22137a5e57 --- /dev/null +++ b/meta-skeleton/recipes-skeleton/service/service_0.1.bb | |||
@@ -0,0 +1,32 @@ | |||
1 | DESCRIPTION = "The canonical example of init scripts" | ||
2 | SECTION = "base" | ||
3 | LICENSE = "GPLv2" | ||
4 | LIC_FILES_CHKSUM = "file://${WORKDIR}/COPYRIGHT;md5=349c872e0066155e1818b786938876a4" | ||
5 | RDEPENDS_${PN} = "initscripts" | ||
6 | PR = "r0" | ||
7 | |||
8 | SRC_URI = "file://skeleton \ | ||
9 | file://skeleton_test.c \ | ||
10 | file://COPYRIGHT \ | ||
11 | " | ||
12 | |||
13 | CONFFILES_${PN} += "${sysconfdir}/init.d/skeleton" | ||
14 | |||
15 | do_compile () { | ||
16 | ${CC} ${WORKDIR}/skeleton_test.c -o ${WORKDIR}/skeleton-test | ||
17 | } | ||
18 | |||
19 | do_install () { | ||
20 | install -d ${D}${sysconfdir}/init.d | ||
21 | cat ${WORKDIR}/skeleton | \ | ||
22 | sed -e 's,/etc,${sysconfdir},g' \ | ||
23 | -e 's,/usr/sbin,${sbindir},g' \ | ||
24 | -e 's,/var,${localstatedir},g' \ | ||
25 | -e 's,/usr/bin,${bindir},g' \ | ||
26 | -e 's,/usr,${prefix},g' > ${D}${sysconfdir}/init.d/skeleton | ||
27 | chmod a+x ${D}${sysconfdir}/init.d/skeleton | ||
28 | |||
29 | install -d ${D}${sbindir} | ||
30 | install -m 0755 ${WORKDIR}/skeleton-test ${D}${sbindir}/ | ||
31 | } | ||
32 | |||