From owner-freebsd-current@FreeBSD.ORG Fri Nov 23 14:39:38 2012 Return-Path: Delivered-To: current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 33A93703; Fri, 23 Nov 2012 14:39:38 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail.allbsd.org (gatekeeper.allbsd.org [IPv6:2001:2f0:104:e001::32]) by mx1.freebsd.org (Postfix) with ESMTP id 4C42A8FC16; Fri, 23 Nov 2012 14:39:37 +0000 (UTC) Received: from alph.allbsd.org (p1137-ipbf1505funabasi.chiba.ocn.ne.jp [118.7.212.137]) (authenticated bits=128) by mail.allbsd.org (8.14.5/8.14.5) with ESMTP id qANEdIUv025619 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 23 Nov 2012 23:39:28 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) (authenticated bits=0) by alph.allbsd.org (8.14.5/8.14.5) with ESMTP id qANEdIbS002005; Fri, 23 Nov 2012 23:39:18 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Fri, 23 Nov 2012 23:37:54 +0900 (JST) Message-Id: <20121123.233754.1596631883684484110.hrs@allbsd.org> To: mwlucas@michaelwlucas.com Subject: Re: after upgrade, can't restart apache via cron From: Hiroki Sato In-Reply-To: <20121123031753.GA59632@bewilderbeast.blackhelicopters.org> References: <20121123031753.GA59632@bewilderbeast.blackhelicopters.org> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.5 on Emacs 23.4 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart0(Fri_Nov_23_23_37_54_2012_910)--" Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97.4 at gatekeeper.allbsd.org X-Virus-Status: Clean X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (mail.allbsd.org [133.31.130.32]); Fri, 23 Nov 2012 23:39:29 +0900 (JST) X-Spam-Status: No, score=-97.6 required=13.0 tests=CONTENT_TYPE_PRESENT, FAKEDWORD_BACKQUOTE,ONLY1HOPDIRECT,SAMEHELOBY2HOP,USER_IN_WHITELIST autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on gatekeeper.allbsd.org Cc: freebsd-rc@FreeBSD.org, current@FreeBSD.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: freebsd-rc@FreeBSD.org List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Nov 2012 14:39:38 -0000 ----Security_Multipart0(Fri_Nov_23_23_37_54_2012_910)-- Content-Type: Multipart/Mixed; boundary="--Next_Part(Fri_Nov_23_23_37_54_2012_649)--" Content-Transfer-Encoding: 7bit ----Next_Part(Fri_Nov_23_23_37_54_2012_649)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit "Michael W. Lucas" wrote in <20121123031753.GA59632@bewilderbeast.blackhelicopters.org>: mw> eval: setfib: not found mw> /usr/local/etc/rc.d/apache22: WARNING: failed to start apache22 mw> mw> If I run /usr/local/etc/rc.d/apache22 restart from the command line, I mw> can restart httpd without trouble. mw> mw> Any thoughts? This was due to $PATH in the cron job as already pointed out, but this should not happen. I attached a patch to use full-path for external commands in rc.subr. If there is no objection to this change I will commit it. -- Hiroki ----Next_Part(Fri_Nov_23_23_37_54_2012_649)-- Content-Type: Text/X-Patch; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="rc.subr.cmdpath.20121123-1.diff" Index: etc/rc.subr =================================================================== --- etc/rc.subr (revision 243327) +++ etc/rc.subr (working copy) @@ -49,6 +49,18 @@ IDCMD="if [ -x $ID ]; then $ID -un; fi" PS="/bin/ps -ww" JID=`$PS -p $$ -o jid=` +CHROOT_CMD="/usr/sbin/chroot" +DEVFS_CMD="/sbin/devfs" +EGREP_CMD="/usr/bin/egrep" +GREP_CMD="/usr/bin/grep" +KLDSTAT_CMD="/sbin/kldstat" +KLDLOAD_CMD="/sbin/kldload" +LOGGER_CMD="/usr/bin/logger" +MDMFS_CMD="/sbin/mdmfs" +MOUNT_CMD="/sbin/mount" +NICE_CMD="/usr/bin/nice" +SETFIB_CMD="/usr/sbin/setfib" +SU_CMD="/usr/bin/su" # # functions @@ -181,7 +193,7 @@ if $_ismounted; then : else - mount $_fs >/dev/null 2>&1 + ${MOUNT_CMD} $_fs >/dev/null 2>&1 fi ) done @@ -726,17 +738,17 @@ check_startmsgs && echo "Starting ${name}." if [ -n "$_chroot" ]; then _doit="\ -${_nice:+nice -n $_nice }\ -${_fib:+setfib -F $_fib }\ -chroot ${_user:+-u $_user }${_group:+-g $_group }${_groups:+-G $_groups }\ +${_nice:+${NICE_CMD} -n $_nice }\ +${_fib:+${SETFIB_CMD} -F $_fib }\ +${CHROOT_CMD} ${_user:+-u $_user }${_group:+-g $_group }${_groups:+-G $_groups }\ $_chroot $command $rc_flags $command_args" else _doit="\ ${_chdir:+cd $_chdir && }\ -${_fib:+setfib -F $_fib }\ +${_fib:+${SETFIB_CMD} -F $_fib }\ $command $rc_flags $command_args" if [ -n "$_user" ]; then - _doit="su -m $_user -c 'sh -c \"$_doit\"'" + _doit="${SU_CMD} -m $_user -c 'sh -c \"$_doit\"'" fi if [ -n "$_nice" ]; then if [ -z "$_user" ]; then @@ -953,7 +965,7 @@ _cmd="kill -$1 $rc_pid" if [ -n "$_user" ]; then - _cmd="su -m ${_user} -c 'sh -c \"${_cmd}\"'" + _cmd="${SU_CMD} -m ${_user} -c 'sh -c \"${_cmd}\"'" fi echo "$_cmd" } @@ -1110,8 +1122,8 @@ exitval=$1 shift - if [ -x /usr/bin/logger ]; then - logger "$0: ERROR: $*" + if [ -x ${LOGGER_CMD} ]; then + ${LOGGER_CMD} "$0: ERROR: $*" fi echo 1>&2 "$0: ERROR: $*" exit $exitval @@ -1123,8 +1135,8 @@ # warn() { - if [ -x /usr/bin/logger ]; then - logger "$0: WARNING: $*" + if [ -x ${LOGGER_CMD} ]; then + ${LOGGER_CMD} "$0: WARNING: $*" fi echo 1>&2 "$0: WARNING: $*" } @@ -1137,8 +1149,8 @@ { case ${rc_info} in [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) - if [ -x /usr/bin/logger ]; then - logger "$0: INFO: $*" + if [ -x ${LOGGER_CMD} ]; then + ${LOGGER_CMD} "$0: INFO: $*" fi echo "$0: INFO: $*" ;; @@ -1155,8 +1167,8 @@ { case ${rc_debug} in [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) - if [ -x /usr/bin/logger ]; then - logger "$0: DEBUG: $*" + if [ -x ${LOGGER_CMD} ]; then + ${LOGGER_CMD} "$0: DEBUG: $*" fi echo 1>&2 "$0: DEBUG: $*" ;; @@ -1320,7 +1332,7 @@ fi eval $rulename=\$rulenum debug "found ruleset: $rulename=$rulenum" - if ! /sbin/devfs rule -s $rulenum delset; then + if ! ${DEVFS_CMD} rule -s $rulenum delset; then _err=1 break fi @@ -1331,7 +1343,7 @@ # other rules if [ -n "$rulecmd" ]; then debug "adding rule ($rulecmd)" - if ! eval /sbin/devfs rule -s $rulenum $rulecmd + if ! eval ${DEVFS_CMD} rule -s $rulenum $rulecmd then _err=1 break @@ -1389,7 +1401,7 @@ return 1 fi debug "$_me: setting ruleset ($rs) on mount-point (${devdir#-m })" - if ! /sbin/devfs $devdir ruleset $rs; then + if ! ${DEVFS_CMD} $devdir ruleset $rs; then warn "$_me: unable to set ruleset $rs to ${devdir#-m }" return 1 fi @@ -1414,7 +1426,7 @@ return 1 fi debug "$_me: applying ruleset ($rs) to mount-point (${devdir#-m })" - if ! /sbin/devfs $devdir rule -s $rs applyset; then + if ! ${DEVFS_CMD} $devdir rule -s $rs applyset; then warn "$_me: unable to apply ruleset $rs to ${devdir#-m }" return 1 fi @@ -1438,14 +1450,14 @@ return 1 fi debug "$_me: mount-point is ($devdir), ruleset is ($rs)" - if ! mount -t devfs dev "$devdir"; then + if ! ${MOUNT_CMD} -t devfs dev "$devdir"; then warn "$_me: Unable to mount devfs on $devdir" return 1 fi if [ -n "$rs" ]; then devfs_init_rulesets devfs_set_ruleset $rs $devdir - devfs -m $devdir rule applyset + ${DEVFS_CMD} -m $devdir rule applyset fi return 0 } @@ -1483,7 +1495,7 @@ if [ -n "$3" ]; then flags="$3" fi - /sbin/mdmfs $flags -s $1 md $2 + ${MDMFS_CMD} $flags -s $1 md $2 } # Code common to scripts that need to load a kernel module @@ -1512,16 +1524,16 @@ _mod=${_mod:-$1} _loaded=false if [ -n "$_re" ]; then - if kldstat -v | egrep -q -e "$_re"; then + if ${KLDSTAT_CMD} -v | ${EGREP_CMD} -q -e "$_re"; then _loaded=true fi else - if kldstat -q -m "$_mod"; then + if ${KLDSTAT_CMD} -q -m "$_mod"; then _loaded=true fi fi if ! $_loaded; then - if ! kldload "$1"; then + if ! ${KLDLOAD_CMD} "$1"; then warn "Unable to load kernel module $1" return 1 else @@ -1607,12 +1619,12 @@ for dir in ${local_startup}; do if [ -d "${dir}" ]; then for file in ${dir}/[0-9]*.sh; do - grep '^# PROVIDE:' $file >/dev/null 2>&1 && + ${GREP_CMD} '^# PROVIDE:' $file >/dev/null 2>&1 && continue zlist="$zlist $file" done for file in ${dir}/[!0-9]*.sh; do - grep '^# PROVIDE:' $file >/dev/null 2>&1 && + ${GREP_CMD} '^# PROVIDE:' $file >/dev/null 2>&1 && continue slist="$slist $file" done @@ -1624,7 +1636,7 @@ local_rc='' for dir in ${local_startup}; do if [ -d "${dir}" ]; then - for file in `grep -l '^# PROVIDE:' ${dir}/* 2>/dev/null`; do + for file in `${GREP_CMD} -l '^# PROVIDE:' ${dir}/* 2>/dev/null`; do case "$file" in *.sample) ;; *) if [ -x "$file" ]; then ----Next_Part(Fri_Nov_23_23_37_54_2012_649)---- ----Security_Multipart0(Fri_Nov_23_23_37_54_2012_910)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEABECAAYFAlCvikIACgkQTyzT2CeTzy2yzACdEQHZqMfc6auIsEPrUgqZ2Jfi rLYAoI8ZS8Pp7aEB2a2+riVyvQBJYqvy =v0c/ -----END PGP SIGNATURE----- ----Security_Multipart0(Fri_Nov_23_23_37_54_2012_910)----