rc startup script - daemon: failed to set user environment

2010-11-03 Thread Valentin Bud
Hello community,

 I am trying to build a startup script for an application built from source
code. The application name is SOGo (sogo.nu).

I will attach the rc  script and the error I receive when I run it.

#!/bin/sh
#
#
# PROVIDE: sogod
# REQUIRE: memcached
#
# Add the following lines to /etc/rc.conf to enable sogod:
#
# sogod_enable (bool):  Set it to YES to enable sogod.
#   Default is NO
#
#

. /etc/rc.subr

name=sogod
rcvar=`set_rcvar`

load_rc_config ${name}

: ${sogod_enable=NO}
: ${sogod_user=sogo}
: ${sogod_workers=-WOWorkersCount 1}
: ${sogod_command=/usr/local/GNUstep/Local/Tools/Admin/sogod}
: ${sogod_logfile=/var/log/sogo/sogo.log}

pidfile=/var/run/sogo/sogo.pid
command=/usr/sbin/daemon
command_args=-f -p ${pidfile} -u ${sogod_user} ${sogod_command}
${sogod_workers} -WOPidFile ${pidfile} -WOLogFile ${sogod_logfile}

start_precmd=${name}_prestart

sogod_prestart() {
if [ ! -d `dirname ${pidfile}` ]; then
mkdir `dirname ${pidfile}` /dev/null 21  chown
${sogod_user} `dirname ${pidfile}`
fi
if [ ! -d `dirname ${sogod_logfile}` ]; then
mkdir `dirname ${sogod_logfile}` /dev/null 21
touch ${sogod_logfile}  chown ${sogod_user}
${sogod_logfile}
fi
if [ -z ${GNUSTEP_SYSTEM_ROOT} ]; then
. /usr/local/GNUstep/System/Library/Makefiles/GNUstep.sh
fi
}

run_rc_command $1

 The sogo daemon requires memcached running to start and the
file ${sogod_logfile}
to be readable by ${sogod_user}. I also requires the
directory /var/run/sogo/ to be read/write
by ${sogod_user} so it can write the PID file. The GNUstep.sh makefile must
be loaded
so it can run properly.

 The other command_args are the startup arguments sogod takes.

memcached is already started:
sogo# sockstat | grep memcached
nobody   memcached  71167 16 tcp4   172.31.32.6:11211 *:*
nobody   memcached  71167 17 udp4   172.31.32.6:11211 *:*

sogod is enabled is /etc/rc.conf
# /usr/local/etc/rc.d/sogod rcvar
# sogod
#
sogod_enable=YES
#   (default: )

This is the error I receive when I try to start sogod
sogo# /usr/local/etc/rc.d/sogod start
Starting sogod.
daemon: failed to set user environment
/usr/local/etc/rc.d/sogod: WARNING: failed to start sogod

 This is the first rc script I write. What can I do to debug the problem
further?

Thank you and have a great day,
v
-- 
network warrior
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: rc startup script - daemon: failed to set user environment

2010-11-03 Thread Frank Shute
On Wed, Nov 03, 2010 at 08:55:45AM +0200, Valentin Bud wrote:

 Hello community,
 
  I am trying to build a startup script for an application built from source
 code. The application name is SOGo (sogo.nu).
 
 I will attach the rc  script and the error I receive when I run it.
 
 #!/bin/sh
 #
 #
 # PROVIDE: sogod
 # REQUIRE: memcached
 #
 # Add the following lines to /etc/rc.conf to enable sogod:
 #
 # sogod_enable (bool):  Set it to YES to enable sogod.
 #   Default is NO
 #
 #
 
 . /etc/rc.subr
 
 name=sogod
 rcvar=`set_rcvar`
 
 load_rc_config ${name}
 
 : ${sogod_enable=NO}
 : ${sogod_user=sogo}
 : ${sogod_workers=-WOWorkersCount 1}
 : ${sogod_command=/usr/local/GNUstep/Local/Tools/Admin/sogod}
 : ${sogod_logfile=/var/log/sogo/sogo.log}
 
 pidfile=/var/run/sogo/sogo.pid
 command=/usr/sbin/daemon
 command_args=-f -p ${pidfile} -u ${sogod_user} ${sogod_command}
 ${sogod_workers} -WOPidFile ${pidfile} -WOLogFile ${sogod_logfile}
 
 start_precmd=${name}_prestart
 
 sogod_prestart() {
 if [ ! -d `dirname ${pidfile}` ]; then
 mkdir `dirname ${pidfile}` /dev/null 21  chown
 ${sogod_user} `dirname ${pidfile}`
 fi
 if [ ! -d `dirname ${sogod_logfile}` ]; then
 mkdir `dirname ${sogod_logfile}` /dev/null 21
 touch ${sogod_logfile}  chown ${sogod_user}
 ${sogod_logfile}
 fi
 if [ -z ${GNUSTEP_SYSTEM_ROOT} ]; then
 . /usr/local/GNUstep/System/Library/Makefiles/GNUstep.sh
 fi
 }
 
 run_rc_command $1
 
  The sogo daemon requires memcached running to start and the
 file ${sogod_logfile}
 to be readable by ${sogod_user}. I also requires the
 directory /var/run/sogo/ to be read/write
 by ${sogod_user} so it can write the PID file. The GNUstep.sh makefile must
 be loaded
 so it can run properly.
 
  The other command_args are the startup arguments sogod takes.
 
 memcached is already started:
 sogo# sockstat | grep memcached
 nobody   memcached  71167 16 tcp4   172.31.32.6:11211 *:*
 nobody   memcached  71167 17 udp4   172.31.32.6:11211 *:*
 
 sogod is enabled is /etc/rc.conf
 # /usr/local/etc/rc.d/sogod rcvar
 # sogod
 #
 sogod_enable=YES
 #   (default: )
 
 This is the error I receive when I try to start sogod
 sogo# /usr/local/etc/rc.d/sogod start
 Starting sogod.
 daemon: failed to set user environment
 /usr/local/etc/rc.d/sogod: WARNING: failed to start sogod
 
  This is the first rc script I write. What can I do to debug the problem
 further?
 
 Thank you and have a great day,
 v
 -- 
 network warrior

Starting with the obvious, did you create a sogo userID with adduser(8)?
You want to give it nologin as a shell. It will also want a group.


Regards,

-- 

 Frank

 Contact info: http://www.shute.org.uk/misc/contact.html


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: rc startup script - daemon: failed to set user environment

2010-11-03 Thread Valentin Bud
On Wed, Nov 3, 2010 at 12:47 PM, Frank Shute fr...@shute.org.uk wrote:

 On Wed, Nov 03, 2010 at 08:55:45AM +0200, Valentin Bud wrote:
 
  Hello community,
 
   I am trying to build a startup script for an application built from
 source
  code. The application name is SOGo (sogo.nu).
 
  I will attach the rc  script and the error I receive when I run it.
 
  #!/bin/sh
  #
  #
  # PROVIDE: sogod
  # REQUIRE: memcached
  #
  # Add the following lines to /etc/rc.conf to enable sogod:
  #
  # sogod_enable (bool):  Set it to YES to enable sogod.
  #   Default is NO
  #
  #
 
  . /etc/rc.subr
 
  name=sogod
  rcvar=`set_rcvar`
 
  load_rc_config ${name}
 
  : ${sogod_enable=NO}
  : ${sogod_user=sogo}
  : ${sogod_workers=-WOWorkersCount 1}
  : ${sogod_command=/usr/local/GNUstep/Local/Tools/Admin/sogod}
  : ${sogod_logfile=/var/log/sogo/sogo.log}
 
  pidfile=/var/run/sogo/sogo.pid
  command=/usr/sbin/daemon
  command_args=-f -p ${pidfile} -u ${sogod_user} ${sogod_command}
  ${sogod_workers} -WOPidFile ${pidfile} -WOLogFile ${sogod_logfile}
 
  start_precmd=${name}_prestart
 
  sogod_prestart() {
  if [ ! -d `dirname ${pidfile}` ]; then
  mkdir `dirname ${pidfile}` /dev/null 21  chown
  ${sogod_user} `dirname ${pidfile}`
  fi
  if [ ! -d `dirname ${sogod_logfile}` ]; then
  mkdir `dirname ${sogod_logfile}` /dev/null 21
  touch ${sogod_logfile}  chown ${sogod_user}
  ${sogod_logfile}
  fi
  if [ -z ${GNUSTEP_SYSTEM_ROOT} ]; then
  . /usr/local/GNUstep/System/Library/Makefiles/GNUstep.sh
  fi
  }
 
  run_rc_command $1
 
   The sogo daemon requires memcached running to start and the
  file ${sogod_logfile}
  to be readable by ${sogod_user}. I also requires the
  directory /var/run/sogo/ to be read/write
  by ${sogod_user} so it can write the PID file. The GNUstep.sh makefile
 must
  be loaded
  so it can run properly.
 
   The other command_args are the startup arguments sogod takes.
 
  memcached is already started:
  sogo# sockstat | grep memcached
  nobody   memcached  71167 16 tcp4   172.31.32.6:11211 *:*
  nobody   memcached  71167 17 udp4   172.31.32.6:11211 *:*
 
  sogod is enabled is /etc/rc.conf
  # /usr/local/etc/rc.d/sogod rcvar
  # sogod
  #
  sogod_enable=YES
  #   (default: )
 
  This is the error I receive when I try to start sogod
  sogo# /usr/local/etc/rc.d/sogod start
  Starting sogod.
  daemon: failed to set user environment
  /usr/local/etc/rc.d/sogod: WARNING: failed to start sogod
 
   This is the first rc script I write. What can I do to debug the problem
  further?
 
  Thank you and have a great day,
  v
  --
  network warrior

 Starting with the obvious, did you create a sogo userID with adduser(8)?
 You want to give it nologin as a shell. It will also want a group.


 Regards,

 --

  Frank

  Contact info: http://www.shute.org.uk/misc/contact.html


 Hello Mr. Frank,

 Yes I did.

sogo# id sogo
uid=1001(sogo) gid=1001(sogo) groups=1001(sogo)

Thank you,
v
-- 
network warrior
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org