issues with htpdate using args twice, and not able to get status

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

issues with htpdate using args twice, and not able to get status

Jason Helfman-7
Hello,

I am trying to fix htpdate startup script, and am having issues figuring this out. Was hoping someone would have an idea what is going on....?
I commented out the stop, because even though the process writes out a pid file, status is unable to detect the running process. It seems that the process is writing out a pid file, however that pid file is perhaps to another pid that spawned off another process to actually start the service. This used to work, and not sure if something changed in the software, or in rc.subr.

The diff also addresses issues picked up in rclint.

Behavior I am trying to fix:
Status should work and return the correct pid.
Command_args should only have the args once, and not repeated.

Thanks in advance!
-jgh

Here is my current diff of the port:

Index: Makefile
===================================================================
--- Makefile (revision 508805)
+++ Makefile (working copy)
@@ -3,7 +3,7 @@
 
 PORTNAME= htpdate
 PORTVERSION= 1.2.1
-PORTREVISION= 2
+PORTREVISION= 3
 CATEGORIES= net ipv6
 MASTER_SITES= http://www.vervest.org/htp/archive/c/ \
  http://twekkel.home.xs4all.nl/htp/
Index: files/htpdate.in
===================================================================
--- files/htpdate.in (revision 508805)
+++ files/htpdate.in (working copy)
@@ -3,8 +3,7 @@
 # $FreeBSD$
 
 # PROVIDE: htpdate
-# REQUIRE: NETWORKING SERVERS
-# BEFORE: DAEMON
+# REQUIRE: NETWORKING syslogd
 # KEYWORD: shutdown
 
 # Add the following line to /etc/rc.conf to enable htpdate:
@@ -14,31 +13,33 @@
 
 . /etc/rc.subr
 
-load_rc_config htpdate
+name=htpdate
+desc="HTTP Time Protocol daemon"
+rcvar=htpdate_enable
 
+load_rc_config ${name}
+
 htpdate_enable="${htpdate_enable:-"NO"}"
 htpdate_servers="${htpdate_servers:-"www.example.com"}"
-htpdate_flags="${htpdate_flags:-"-l -s -D"}"
+htpdate_flags="${htpdate_flags:-"-lsD"}"
 
-name=htpdate
-rcvar=htpdate_enable
-servers=${htpdate_servers}
+command=/usr/local/bin/htpdate
 pidfile=/var/run/htpdate.pid
 
-command="/usr/local/bin/htpdate"
-command_args="${htpdate_flags} $servers"
-stop_cmd=htpdate_stop
+command_args="$htpdate_flags $htpdate_servers"
 
-htpdate_stop ()
-{
- if [ -f ${pidfile} ]; then
- echo "Stopping htpdate."
- kill `cat ${pidfile}`
- else
- echo "htpdate is not running."
- fi
+#stop_cmd=htpdate_stop
 
- rm -f ${pidfile}
-}
+#htpdate_stop()
+#{
+# if [ -f ${pidfile} ]; then
+# echo "Stopping ${name}."
+# kill `cat ${pidfile}`
+# else
+# echo "${name} is not running."
+# fi
+#
+# rm -f ${pidfile}
+#}

Here is the output with debugging turned on:
 
 run_rc_command "$1"
+ htpdate_enable=YES
+ local_unbound_enable=YES
+ sourced_files=:/etc/rc.conf::/etc/rc.conf.local:
+ [ -r /etc/rc.conf.local ]
+ _rc_conf_loaded=true
+ [ -n htpdate ]
+ _d=/etc
+ [ -f /etc/rc.conf.d/htpdate ]
+ [ -d /etc/rc.conf.d/htpdate ]
+ _d=/usr/local/etc
+ [ -f /usr/local/etc/rc.conf.d/htpdate ]
+ [ -d /usr/local/etc/rc.conf.d/htpdate ]
+ eval '_defval=$htpdate_enable_defval'
+ _defval=''
+ [ -n '' ]
+ htpdate_enable=YES
+ htpdate_servers=www.example.com
+ htpdate_flags=-lsD
+ command=/usr/local/bin/htpdate
+ pidfile=/var/run/htpdate.pid
+ command_args='-lsD www.example.com'
+ run_rc_command restart
+ _return=0
+ rc_arg=restart
+ [ -z htpdate ]
+ shift 1
+ rc_extra_args=''
+ _rc_prefix=''
+ eval '_override_command=$htpdate_program'
+ _override_command=''
+ command=/usr/local/bin/htpdate
+ _keywords='start stop restart rcvar enable disable delete enabled describe extracommands '
+ rc_pid=''
+ _pidcmd=''
+ _procname=/usr/local/bin/htpdate
+ [ -n /usr/local/bin/htpdate ]
+ [ -n /var/run/htpdate.pid ]
+ _pidcmd='rc_pid=$(check_pidfile /var/run/htpdate.pid /usr/local/bin/htpdate )'
+ _keywords='start stop restart rcvar enable disable delete enabled describe extracommands  status poll'
+ [ -z restart ]
+ [ restart '=' enabled ]
+ [ -n '' ]
+ eval 'rc_flags=$htpdate_flags'
+ rc_flags=-lsD
+ eval '_chdir=$htpdate_chdir' '_chroot=$htpdate_chroot' '_nice=$htpdate_nice' '_user=$htpdate_user' '_group=$htpdate_group' '_groups=$htpdate_groups' '_fib=$htpdate_fib' '_env=$htpdate_env' '_prepend=$htpdate_prepend' '_login_class=${htpdate_login_class:-daemon}' '_limits=$htpdate_limits' '_oomprotect=$htpdate_oomprotect' '_env_file=$htpdate_env_file'
+ _chdir='' _chroot='' _nice='' _user='' _group='' _groups='' _fib='' _env='' _prepend='' _login_class=daemon _limits='' _oomprotect='' _env_file=''
+ [ -n '' ]
+ [ -n '' ]
+ [ -z '' ]
+ eval 'rc_pid=$(check_pidfile' /var/run/htpdate.pid /usr/local/bin/htpdate ')'
+ check_pidfile /var/run/htpdate.pid /usr/local/bin/htpdate
+ _pidfile=/var/run/htpdate.pid
+ _procname=/usr/local/bin/htpdate
+ _interpreter=''
+ [ -z /var/run/htpdate.pid -o -z /usr/local/bin/htpdate ]
+ [ ! -f /var/run/htpdate.pid ]
+ debug 'pid file (/var/run/htpdate.pid): not readable.'
+ return
+ rc_pid=''
+ [ start '!=' restart ]
+ continue
+ [ stop '!=' restart ]
+ continue
+ [ restart '!=' restart ]
+ [ -n htpdate_enable -a restart '!=' rcvar -a restart '!=' stop -a restart '!=' delete -a restart '!=' enable -a restart '!=' describe ]
+ checkyesno htpdate_enable
+ eval '_value=$htpdate_enable'
+ _value=YES
+ debug 'checkyesno: htpdate_enable is set to YES.'
+ return 0
+ [ restart '=' start -a -z '' -a -n '' ]
+ eval '_cmd=$restart_cmd' '_precmd=$restart_precmd' '_postcmd=$restart_postcmd'
+ _cmd='' _precmd='' _postcmd=''
+ [ -n '' ]
+ false
+ _rc_restart_done=true
+ _run_rc_precmd
+ check_required_before restart
+ local _f
+ return 0
+ [ -n '' ]
+ check_required_after restart
+ local _f _args
+ return 0
+ return 0
+ run_rc_command stop
+ _return=0
+ rc_arg=stop
+ [ -z htpdate ]
+ shift 1
+ rc_extra_args=''
+ _rc_prefix=''
+ eval '_override_command=$htpdate_program'
+ _override_command=''
+ command=/usr/local/bin/htpdate
+ _keywords='start stop restart rcvar enable disable delete enabled describe extracommands '
+ rc_pid=''
+ _pidcmd=''
+ _procname=/usr/local/bin/htpdate
+ [ -n /usr/local/bin/htpdate ]
+ [ -n /var/run/htpdate.pid ]
+ _pidcmd='rc_pid=$(check_pidfile /var/run/htpdate.pid /usr/local/bin/htpdate )'
+ _keywords='start stop restart rcvar enable disable delete enabled describe extracommands  status poll'
+ [ -z stop ]
+ [ stop '=' enabled ]
+ [ -n '' ]
+ eval 'rc_flags=$htpdate_flags'
+ rc_flags=-lsD
+ eval '_chdir=$htpdate_chdir' '_chroot=$htpdate_chroot' '_nice=$htpdate_nice' '_user=$htpdate_user' '_group=$htpdate_group' '_groups=$htpdate_groups' '_fib=$htpdate_fib' '_env=$htpdate_env' '_prepend=$htpdate_prepend' '_login_class=${htpdate_login_class:-daemon}' '_limits=$htpdate_limits' '_oomprotect=$htpdate_oomprotect' '_env_file=$htpdate_env_file'
+ _chdir='' _chroot='' _nice='' _user='' _group='' _groups='' _fib='' _env='' _prepend='' _login_class=daemon _limits='' _oomprotect='' _env_file=''
+ [ -n '' ]
+ [ -n '' ]
+ [ -z '' ]
+ eval 'rc_pid=$(check_pidfile' /var/run/htpdate.pid /usr/local/bin/htpdate ')'
+ check_pidfile /var/run/htpdate.pid /usr/local/bin/htpdate
+ _pidfile=/var/run/htpdate.pid
+ _procname=/usr/local/bin/htpdate
+ _interpreter=''
+ [ -z /var/run/htpdate.pid -o -z /usr/local/bin/htpdate ]
+ [ ! -f /var/run/htpdate.pid ]
+ debug 'pid file (/var/run/htpdate.pid): not readable.'
+ return
+ rc_pid=''
+ [ start '!=' stop ]
+ continue
+ [ stop '!=' stop ]
+ [ -n htpdate_enable -a stop '!=' rcvar -a stop '!=' stop -a stop '!=' delete -a stop '!=' enable -a stop '!=' describe ]
+ [ -n htpdate_enable -a stop '=' stop -a -z '' ]
+ checkyesno htpdate_enable
+ eval '_value=$htpdate_enable'
+ _value=YES
+ debug 'checkyesno: htpdate_enable is set to YES.'
+ return 0
+ [ stop '=' start -a -z '' -a -n '' ]
+ eval '_cmd=$stop_cmd' '_precmd=$stop_precmd' '_postcmd=$stop_postcmd'
+ _cmd='' _precmd='' _postcmd=''
+ [ -n '' ]
+ [ -z '' ]
+ [ -n '' ]
+ _run_rc_notrunning
+ local _pidmsg
+ [ -n /var/run/htpdate.pid ]
+ _pidmsg=' (check /var/run/htpdate.pid).'
+ echo 'htpdate not running? (check /var/run/htpdate.pid).'
htpdate not running? (check /var/run/htpdate.pid).
+ return 1
+ run_rc_command start
+ _return=0
+ rc_arg=start
+ [ -z htpdate ]
+ shift 1
+ rc_extra_args=''
+ _rc_prefix=''
+ eval '_override_command=$htpdate_program'
+ _override_command=''
+ command=/usr/local/bin/htpdate
+ _keywords='start stop restart rcvar enable disable delete enabled describe extracommands '
+ rc_pid=''
+ _pidcmd=''
+ _procname=/usr/local/bin/htpdate
+ [ -n /usr/local/bin/htpdate ]
+ [ -n /var/run/htpdate.pid ]
+ _pidcmd='rc_pid=$(check_pidfile /var/run/htpdate.pid /usr/local/bin/htpdate )'
+ _keywords='start stop restart rcvar enable disable delete enabled describe extracommands  status poll'
+ [ -z start ]
+ [ start '=' enabled ]
+ [ -n '' ]
+ eval 'rc_flags=$htpdate_flags'
+ rc_flags=-lsD
+ eval '_chdir=$htpdate_chdir' '_chroot=$htpdate_chroot' '_nice=$htpdate_nice' '_user=$htpdate_user' '_group=$htpdate_group' '_groups=$htpdate_groups' '_fib=$htpdate_fib' '_env=$htpdate_env' '_prepend=$htpdate_prepend' '_login_class=${htpdate_login_class:-daemon}' '_limits=$htpdate_limits' '_oomprotect=$htpdate_oomprotect' '_env_file=$htpdate_env_file'
+ _chdir='' _chroot='' _nice='' _user='' _group='' _groups='' _fib='' _env='' _prepend='' _login_class=daemon _limits='' _oomprotect='' _env_file=''
+ [ -n '' ]
+ [ -n '' ]
+ [ -z '' ]
+ eval 'rc_pid=$(check_pidfile' /var/run/htpdate.pid /usr/local/bin/htpdate ')'
+ check_pidfile /var/run/htpdate.pid /usr/local/bin/htpdate
+ _pidfile=/var/run/htpdate.pid
+ _procname=/usr/local/bin/htpdate
+ _interpreter=''
+ [ -z /var/run/htpdate.pid -o -z /usr/local/bin/htpdate ]
+ [ ! -f /var/run/htpdate.pid ]
+ debug 'pid file (/var/run/htpdate.pid): not readable.'
+ return
+ rc_pid=''
+ [ start '!=' start ]
+ [ -n htpdate_enable -a start '!=' rcvar -a start '!=' stop -a start '!=' delete -a start '!=' enable -a start '!=' describe ]
+ checkyesno htpdate_enable
+ eval '_value=$htpdate_enable'
+ _value=YES
+ debug 'checkyesno: htpdate_enable is set to YES.'
+ return 0
+ [ start '=' start -a -z '' -a -n '' ]
+ eval '_cmd=$start_cmd' '_precmd=$start_precmd' '_postcmd=$start_postcmd'
+ _cmd='' _precmd='' _postcmd=''
+ [ -n '' ]
+ [ ! -x /usr/local/bin/htpdate ]
+ _run_rc_precmd
+ check_required_before start
+ local _f
+ return 0
+ [ -n '' ]
+ check_required_after start
+ local _f _args
+ return 0
+ return 0
+ check_startmsgs
+ [ -n '' ]
+ return 0
+ echo 'Starting htpdate.'
Starting htpdate.
+ [ -n '' ]
+ _cd=''
+ _doit='/usr/local/bin/htpdate -lsD -lsD www.example.com'
+ [ -n '' ]
+ [ -n '' ]
+ [ -n '' ]
+ _doit=' limits -C daemon  /usr/local/bin/htpdate -lsD -lsD www.example.com'
+ _run_rc_doit ' limits -C daemon  /usr/local/bin/htpdate -lsD -lsD www.example.com'
+ debug 'run_rc_command: doit:  limits -C daemon  /usr/local/bin/htpdate -lsD -lsD www.example.com'
+ eval ' limits -C daemon  /usr/local/bin/htpdate -lsD -lsD www.example.com'
+ limits -C daemon /usr/local/bin/htpdate -lsD -lsD www.example.com
+ _return=0
+ [ 0 -ne 0 ]
+ return 0
+ _run_rc_postcmd
+ [ -n '' ]
+ return 0
+ [ -n '' ]
+ return 0
+ _return=0
+ [ 0 -ne 0 ]
+ _run_rc_postcmd
+ [ -n '' ]
+ return 0
+ return 0

_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-rc
To unsubscribe, send any mail to "[hidden email]"