I emerged sci-misc/boinc and I had some problems with running it and mainly with stoping the daemon. When I "stopped" it and tried to run it again message WARNING: "boinc" has already been started. appeared and it was hard to find why - there was lockfile but also there was file link boinc in /var/lib/init.d/started Reproducible: Always Steps to Reproduce: 1. emerge sci-misc/boinc 2. run /etc/init.d/boinc start 3. run /etc/init.d/boinc stop 4. run /etc/init.d/boinc start again Actual Results: Message WARNING: "boinc" has already been started. appears, but no process is running. Expected Results: It stops process corretly I altered boinc runscript to: #!/sbin/runscript opts="${opts} attach" depend() { use dns need net } start() { ebegin "Starting BOINC" if [ ! -d ${RUNTIMEDIR} ]; then einfo "Directory ${RUNTIMEDIR} not existing, creating now." /bin/mkdir ${RUNTIMEDIR} /bin/chown ${USER}:${GROUP} ${RUNTIMEDIR} if [ ! -d ${RUNTIMEDIR} ]; then eerror "Directory ${RUNTIMEDIR} could not be created!" return 1 fi fi cd ${RUNTIMEDIR} #if [ ! -f lockfile ]; then # einfo "File ${RUNTIMEDIR}/lockfile does not exist, assuming first run." # einfo "You need to setup an account on the BOINC project homepage beforehand! Go to http://boinc.berkeley.edu/ and locate your project." # einfo "Then either run /etc/init.d/boinc attach or connect with a gui client and attach to a project with that." #fi # if the log file doesn't exist, create it with root privs, then change ownership to boinc if [ ! -f ${LOGFILE} ]; then touch ${LOGFILE} chown ${USER}:${GROUP} ${LOGFILE} else day=`date +"%F_%T"` mv ${LOGFILE} ${LOGFILE}_${day}.old touch ${LOGFILE} chown ${USER}:${GROUP} ${LOGFILE} fi if [ ${ALLOW_REMOTE_RPC} = "yes" ]; then ARGS="${ARGS} -allow_remote_gui_rpc" fi # if NO_GUI variable is defined if [ ! -z ${NO_GUI} ] then if [ "x"$NO_GUI = "x-no_gui_rpc" ] then ARGS="${ARGS} $NO_GUI" else # log error eerror "Expected value of NO_GUI variable is '-no_gui_rpc' if set. Actual value is '${NO_GUI}'." return 1 fi fi if [ ! -z ${BOINC_HOME} ] then if [ ! -d ${BOINC_HOME} ] then eerror "Directory ${BOINC_HOME} not exist" return 1 else check_permissions ${BOINC_HOME} ${USER} 2 # 2 = write if [ $? -ne 0 ] then eerror "No permisions to write to '${BOINC_HOME}' directory for user '${USER}' nor group '${GROUP}'." return 1 fi fi else eerror "'BOINC_HOME' variable not set" return 1 fi if [ -z ${PIDFILE} ] then eerror "'PIDFILE' variable not set" return 1 else piddir=`echo ${PIDFILE} | sed -n s'/\(.*\/\)[^\/]*/\1/'p` if [ -d ${piddir} ] then check_permissions ${piddir} ${USER} 2 # 2 = write if [ $? -ne 0 ] then eerror "No permissions to write to '${piddir}' directory." return 1 fi else eerror "Directory '${piddir}' doesn't exist" return 1 fi fi #setsid start-stop-daemon --quiet --start --chdir ${RUNTIMEDIR} \ # --pidfile "/var/run/boinc.pid"--exec ${BOINCBIN} --chuid ${USER}:${GROUP} \ # --nicelevel ${NICELEVEL} -- ${ARGS} > ${LOGFILE} 2>&1 & setsid start-stop-daemon --quiet --start --exec ${BOINCBIN} --chuid ${USER}:${GROUP} \ --nicelevel ${NICELEVEL} --chdir ${BOINC_HOME} --make-pidfile --pidfile "${PIDFILE}" -- -dir ${BOINC_HOME} > ${LOGFILE} 2>&1 & eend $? } attach() { # stop running boinc if [ -f ${PIDFILE} ] # if pidfile exists then pid=`head -n 1 ${PIDFILE}` # if there is boinc process running with pid from pidfile if [ -z "`ps aux|grep ${pid}|grep boinc|grep -v grep`" ] then start-stop-daemon --quiet --stop --pidfile ${PIDFILE} -- fi fi printf " Enter the Project URL: " read url printf " Enter your Account Key: " read key ebegin "Attaching to project" setsid start-stop-daemon --quiet --start --exec ${BOINCBIN} --chuid ${USER}:${GROUP} \ --nicelevel ${NICELEVEL} --chdir ${BOINC_HOME} --make-pidfile --pidfile "${PIDFILE}" --\ -attach_project ${url} ${key} > ${LOGFILE} 2>&1 & eend $? } stop() { ebegin "Stopping BOINC" # start-stop-daemon --stop --quiet --exec ${BOINCBIN} --pidfile "/var/run/boinc.pid" start-stop-daemon --quiet --stop --pidfile ${PIDFILE} -- > ${LOGFILE} 2>&1 & eend $? } restart() { svc_stop sleep 6 svc_start } check_permissions() { if [ -z "`grep $2 /etc/passwd`" ] # check if user is in the system then echo "User $2 does not exist." return -1 fi if [ -z "$2" ] # user parameter missing then user=`id --user --name` else user=$2 fi if [ "x"$2 == "xroot" ] then echo "root have all privileges" return 0 fi if [ -z "$3" ] # permission not requested then 3=7 fi perm=`stat --format=%a $1` if [ ${perm} -lt 10 ] then perm="00"${perm} elif [ ${perm} -lt 100 ] then perm="0"${perm} fi owner=`echo ${perm} | sed -n s'/\(.\)../\1/'p` group=`echo ${perm} | sed -n s'/.\(.\)./\1/'p` other=`echo ${perm} | sed -n s'/..\(.\)/\1/'p` permFromOther=$((${other}&$3)) if [ ${permFromOther} -eq $3 ] then # all users have requested rights for file return 0 fi ownerUser=`stat --format=%U $1` if [ ${ownerUser} = ${user} ] then permFromOwner=$((${owner}&$3)) else permFromOwner=0 fi if [ ${permFromOwner} -eq $3 ] then # owner have requested permissions return 0 fi # get group name groupName=`stat --format=%G $1` # check if user is in group, remove first part inOwnerGroup=`id --name --groups ${user} | grep ${groupName}` if [ -z "${inOwnerGroup}" ] then # user is not in group that owns file permFromGroup=0 else permFromGroup=$((${group}&$3)) fi # last check is if together the permissions give required permission userAndGroupPerm=$((${permFromOwner}|${permFromGroup})) perms=$((${userAndGroupPerm}|${permFromOther})) permissionsSum=$((${perms}&$3)) if [ ${permissionsSum} -eq $3 ] then return 0 else return 1 fi } And it works fine for me now.
Reopen with a unified diff against current initscript attached, please. Really no idea what you changed.
Created attachment 131751 [details] diff for boinc initscript requested diff
Created attachment 131752 [details] boinc conf file diff there are some new variables in configuration file, so I added that diff too
Requested diff file(s) added.
Uhm, unified diff (the readable one) != context diff; see the nice manpage ;)
Created attachment 131753 [details] unified diff for boinc initscript
Created attachment 131755 [details] unified diff for boinc configuration file
Sorry, I didn't realized what you requested, I didn't know this option. Thanks I learned something :-)
Created attachment 152839 [details, diff] Fix The issue is still there. The boinc client takes a few seconds to shut down, so the init script fails. The attached fix works for me.
Created attachment 152841 [details, diff] Better fix. restart() doesn't have to wait.
# ChangeLog for sci-misc/boinc # Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 # $Header: /var/cvsroot/gentoo-x86/sci-misc/boinc/ChangeLog,v 1.45 2009/01/02 20:40:21 cryos Exp $ 02 Jan 2009; Marcus D. Hanwell <cryos@gentoo.org> metadata.xml: Removed myself as maintainer.
Something similar is in new boinc initscript (since version 6.4.5). Enjoy and report all problems you encounter :]