Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
ntpd starting although it shouldn't [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
gentuser27
n00b
n00b


Joined: 02 Jun 2016
Posts: 8

PostPosted: Thu Jun 02, 2016 4:34 pm    Post subject: ntpd starting although it shouldn't [SOLVED] Reply with quote

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
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Thu Jun 02, 2016 7:03 pm    Post subject: Re: ntpd starting although it shouldn't Reply with quote

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
View user's profile Send private message
gentuser27
n00b
n00b


Joined: 02 Jun 2016
Posts: 8

PostPosted: Thu Jun 02, 2016 7:29 pm    Post subject: Reply with quote

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
View user's profile Send private message
gentuser27
n00b
n00b


Joined: 02 Jun 2016
Posts: 8

PostPosted: Thu Jun 02, 2016 7:32 pm    Post subject: Reply with quote

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
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Thu Jun 02, 2016 7:46 pm    Post subject: Reply with quote

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
View user's profile Send private message
gentuser27
n00b
n00b


Joined: 02 Jun 2016
Posts: 8

PostPosted: Thu Jun 02, 2016 7:52 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum