View previous topic :: View next topic |
Author |
Message |
gentuser27 n00b
Joined: 02 Jun 2016 Posts: 8
|
Posted: Thu Jun 02, 2016 4:34 pm Post subject: ntpd starting although it shouldn't [SOLVED] |
|
|
Hello Gentoo users,
the program ntpd from the package net-misc/ntp has a script in init.d:
Code: | #!/sbin/openrc-run
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
description="ntpd - the network time protocol daemon"
pidfile="/var/run/ntpd.pid"
command="/usr/sbin/ntpd"
command_args="-p ${pidfile} ${NTPD_OPTS}"
start_stop_daemon_args="--pidfile ${pidfile}"
depend() {
use net dns logger
after ntp-client
}
start_pre() {
if [ ! -f /etc/ntp.conf ] ; then
eerror "Please create /etc/ntp.conf"
return 1
fi
return 0
} |
As you see there is no start() function. But this service starts flawlessly anyway...
Could someone explain this to me?
If I create an identical file with a different name and matching file in conf.d I get this:
Code: | * rc-service: Exec format error |
What does ntpd make different?
Last edited by gentuser27 on Thu Jun 02, 2016 7:54 pm; edited 1 time in total |
|
Back to top |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Thu Jun 02, 2016 7:03 pm Post subject: Re: ntpd starting although it shouldn't |
|
|
Joseph Thommes wrote: | As you see there is no start() function. But this service starts flawlessly anyway...
Could someone explain this to me? |
Joseph ... stop, start, restart, describe, and zap are implicit:
openrc-run.c: | const char *extraopts = "stop | start | restart | describe | zap"; |
Joseph Thommes wrote: | If I create an identical file with a different name and matching file in conf.d I get this:
Code: | * rc-service: Exec format error |
What does ntpd make different? |
If you change the name then the service will attempt to execute that name, and in the above case it can't (as it doesn't exist).
best ... khay |
|
Back to top |
|
|
gentuser27 n00b
Joined: 02 Jun 2016 Posts: 8
|
Posted: Thu Jun 02, 2016 7:29 pm Post subject: |
|
|
First, thanks for the answer.
I'm not quite sure whether I understood you correctly, but if I for example create a file called nano with this content:
/etc/init.d/nano:
Code: | #!/sbin/openrc-run
command="/usr/bin/vim" |
This service starts obviously vim...
What exactly do you mean by the service will attempt to execute that name?
Joseph |
|
Back to top |
|
|
gentuser27 n00b
Joined: 02 Jun 2016 Posts: 8
|
Posted: Thu Jun 02, 2016 7:32 pm Post subject: |
|
|
First, thanks for the answer.
I'm not quite sure whether I understood you correctly, but if I for example create a file called nano with this content:
/etc/init.d/nano:
Code: | #!/sbin/openrc-run
command="/usr/bin/vim" |
This service starts obviously vim...
What exactly do you mean by the service will attempt to execute that name?
Joseph |
|
Back to top |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Thu Jun 02, 2016 7:46 pm Post subject: |
|
|
Joseph Thommes wrote: | What exactly do you mean by the service will attempt to execute that name? |
Joseph ... I had assumed (in the absence of the example) that you had copied the ntpd initscript, and had perhaps named it ntpd.1 ... this ".1" will have a distinct meaning for openrc-run, it will denote {service}.{runlevel}. However, from your provided example (nano/vim) the exec format error is probably due to your attempting to start an interactive command ... which you can't do.
best ... khay |
|
Back to top |
|
|
gentuser27 n00b
Joined: 02 Jun 2016 Posts: 8
|
Posted: Thu Jun 02, 2016 7:52 pm Post subject: |
|
|
The nano/vim service starts just fine, but I found out that I had a typo in my other file, so the topic is done.
thanks anyway |
|
Back to top |
|
|
|