rpms/boinc-client/F-10 boinc-client-init-d, 1.6, 1.7 boinc-client.spec, 1.24, 1.25
Miloš Jakubíček
mjakubicek at fedoraproject.org
Wed Mar 18 10:34:12 UTC 2009
- Previous message (by thread): rpms/gimp/F-9 .cvsignore, 1.48, 1.49 gimp.spec, 1.171, 1.172 sources, 1.48, 1.49
- Next message (by thread): rpms/boinc-client/F-9 boinc-client-init-d, 1.6, 1.7 boinc-client.spec, 1.18, 1.19
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: mjakubicek
Update of /cvs/pkgs/rpms/boinc-client/F-10
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv17611
Modified Files:
boinc-client-init-d boinc-client.spec
Log Message:
* Tue Mar 17 2009 Milos Jakubicek <xjakub at fi.muni.cz> - 6.4.7-5.r17542svn
- Wait longer when checking start/stop result in the init script.
* Wed Mar 11 2009 Milos Jakubicek <xjakub at fi.muni.cz> - 6.4.7-4.r17542svn
- Rewritten init script: honours localisation, fixed reload action, doesn't
output garbage into logfiles (resolves BZ#489378), do not leave stale init
script process on startup, uses /etc/init.d/functions instead of own stuff.
Index: boinc-client-init-d
===================================================================
RCS file: /cvs/pkgs/rpms/boinc-client/F-10/boinc-client-init-d,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- boinc-client-init-d 8 Mar 2009 21:14:14 -0000 1.6
+++ boinc-client-init-d 18 Mar 2009 10:33:42 -0000 1.7
@@ -1,24 +1,20 @@
-#!/bin/sh
+#!/bin/bash
#
# BOINC - start and stop the BOINC client daemon on Unix
#
-# Unix start/stop script to run the BOINC client as a daemon at
-# system startup, as the 'boinc' user (not root!).
+# SysVInit start/stop script to run the BOINC client as a daemon at
+# system startup, as the $BOINCUSER (not root!).
#
-# This version works on Red Hat Linux, Fedora, Mandrake, Debian,
-# and Slackware Linux, and should work on generic Linux systems
-# provided that they have 'pidof' (most do).
-# Metadata for chkconfig and the SUSE equivalent INIT info are included below.
+# This version has been modified for Fedora/RHEL.
#
-# Usage: boinc { start | stop | status | reload | restart }
-#
###
# chkconfig: - 98 02
# description: This script starts the local BOINC client as a daemon
# For more information about BOINC (the Berkeley Open Infrastructure
# for Network Computing) see http://boinc.berkeley.edu
-# processname: boinc
-# config: /etc/sysconfig/boinc
+# processname: boinc-client
+# pidfile: /var/run/boinc-client.pid
+# config: /etc/sysconfig/boinc-client
#
### BEGIN INIT INFO
# Provides: boinc
@@ -32,222 +28,166 @@
# for Network Computing) see http://boinc.berkeley.edu
### END INIT INFO
#
+# Based on the init script provided by:
# Eric Myers <myers at vassar.edu> - 27 July 2004
# Department of Physics and Astronomy, Vassar College, Poughkeepsie NY
# Eric Myers <myers at spy-hill.net>
# Spy Hill Research, Poughkeepsie, New York
-# @(#) $Id$
+#
+# Rewritten by Milos Jakubicek <xjakub at fi.muni.cz> - 10 March 2009
+# Faculty of Informatics, Masaryk University Brno, Czech Republic
########################################################################
# Defaults, which can be overridden by putting new NAME=value lines
-# in /etc/sysconfig/boinc (for Red Hat/Fedora Linux and variants)
-# or /etc/default/boinc (for Debian/Ubuntu and variants)
+# in /etc/sysconfig/boinc-client
# Name of user to run as:
-#
+
BOINCUSER=boinc
-# Working directory. Could be /home/boinc, /var/lib/boinc, etc..
-# The reason I prefer /var/lib/boinc is that this works best for a
-# cluster of computers where /home/anything might be shared between machines
-#
-BOINCDIR=/var/lib/boinc
+# Working directory.
-# Name of the client executable. This is the file "boinc" if you
-# unpacked the download file boinc_M.mm.rr_i686-pc-linux-gnu.sh,
-# but I like to rename it and put it in a public place.
-# (Hint: move boincmgr to /usr/local/bin too so anyone can easily use it).
-#
+BOINCDIR="/var/lib/boinc"
-BOINCEXE=/usr/bin/boinc_client
-BOINCCMD=/usr/bin/boinc_cmd
+# Name of the client executable.
-# Log and error files (you should rotate these occasionally)
-#
-LOGFILE=/var/log/boinc.log
-ERRORLOG=/var/log/boincerr.log
+BOINCEXE="/usr/bin/boinc_client"
+BOINCCMD="/usr/bin/boinccmd"
+
+# Log and error files (should be placed in /var/log/ to avoid SELinux related issues)
+
+LOGFILE="/var/log/boinc.log"
+ERRORLOG="/var/log/boincerr.log"
# BOINC options: for the command line when running the client.
-# Be aware that --allow_remote_gui_rpc opens up your machine to the world!
-#
-#BOINCOPTS="--allow_remote_gui_rpc"
-BOINCOPTS=" --daemon"
-# Subsys lock file ...
+BOINCOPTS=
-# If there is the subsys directory, then use it ...
-if [ -d /var/lock/subsys/ ]; then
- LOCKFILE=/var/lock/subsys/boinc-client
-elif [ -d /var/lock ]; then
- LOCKFILE=/var/lock/boinc-client
-fi
+# Service name
-# su on Linux seems to need this to be set to work properly in a script
-export TERM dumb
+prog=boinc-client
+# Subsys lock file and pid file
-##
-# Init script function library. This stuff is Red Hat specific,
-# but if the functions are not found we create our own simple replacements.
-# (The idea for replacing the functions comes from OpenAFS. Thanks guys!)
-
-if [ -f /etc/rc.d/init.d/functions ] ; then
- . /etc/rc.d/init.d/functions
-else
- export PATH=/sbin:/bin:/usr/sbin:/usr/bin
- function echo_success () { echo -n " [ OK ] " ; }
- function echo_failure () { echo -n " [FAILED] " ; }
- function echo_warning () { echo -n " [WARNING] " ; }
- function killproc() {
- PID=`pidof -s -x -o $$ -o $PPID -o %PPID $1`
- [ $PID ] && kill $PID ; }
-fi
+LOCKFILE="/var/lock/subsys/$prog"
+# Init script function library.
-## Look for any local configuration settings which override all above
+. /etc/rc.d/init.d/functions
-if [ -f /etc/sysconfig/boinc-client ]; then
- . /etc/sysconfig/boinc-client
-elif [ -f /etc/default/boinc-client ]; then
- . /etc/default/boinc-client
-fi
+# Look for any local configuration settings which override all above
+[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
-## Verify the working directory exists:
+# Verify the $BOINCDIR working directory exists
if [ ! -d $BOINCDIR ]; then
- echo -n "Cannot find BOINC directory $BOINCDIR "
- echo_failure
- echo
- exit 7
+ echo -n "Cannot find BOINC directory $BOINCDIR"
+ echo_failure
+ echo
+ exit 7
fi
-
-# Some additional places to look for the client executable
-# (Should do this after init.d/functions and sysconfig/boinc, which sets PATH)
-
-export PATH=$BOINCDIR:/usr/local/bin:$PATH
-
-
-## Locate the executable, either boinc_client, boinc,
-## or boinc_M.mm_.... with highest version number
-## We only do this if BOINCEXE set above isn't found or is not executable.
+# Verify the $BOINCEXE executable exists
if [ ! -x $BOINCEXE ]; then
- BOINCEXE=`/usr/bin/which boinc_client 2>/dev/null`
- if [ ! -x "$BOINCEXE" ]; then
- BOINCEXE=`/usr/bin/which boinc 2>/dev/null`
- fi
-fi
-
-if [ ! -x "$BOINCEXE" ]; then
- echo -n "Cannot find an executable for the BOINC client."
- echo_failure
- echo
- exit 2
+ echo -n "Cannot find an executable for the BOINC client."
+ echo_failure
+ echo
+ exit 2
fi
+# Warn if there're no projects attached
+cd $BOINCDIR
+if [ ! -d projects ] ; then
+ echo -n "BOINC client requires initialization (no projects attached)."
+ echo_warning
+ echo
+fi
-## Functions: $1 is one of start|stop|status|reload|restart
+check_status() {
+ status $BOINCEXE
+}
-case "$1" in
- start)
- cd $BOINCDIR
+start() {
+ check_status >& /dev/null && exit 0
+ echo -n $"Starting $prog: "
+
+ # Check that we're a privileged user
+ if [ `id -u` != 0 ] ; then
+ echo -n "Insufficient rights."
+ failure
+ echo
+ exit 4
+ fi
- if [ ! -d projects ] ; then
- echo -n "The BOINC client requires initialization (no projects attached)."
- echo_warning
- echo
- fi
+ # Check that log files exist, otherwise create them with proper ownership
+ if [ ! -e $LOGFILE ]; then
+ touch $LOGFILE && chown $BOINCUSER:$BOINCUSER $LOGFILE
+ fi
+ if [ ! -e $ERRORLOG ]; then
+ touch $ERRORLOG && chown $BOINCUSER:$BOINCUSER $ERRORLOG
+ fi
- echo -n "Starting BOINC client as a daemon: "
-
- # Check that we're a privileged user
- if [ `id -u` != 0 ] ; then
- echo -n "Insufficient rights."
- echo_failure
- echo
- exit 4
- fi
+ daemon --check $BOINCEXE --user $BOINCUSER +19 "$BOINCEXE $BOINCOPTS --dir $BOINCDIR >>$LOGFILE 2>>$ERRORLOG &" >& /dev/null
- daemon --check $BOINCEXE --user $BOINCUSER +19 "$BOINCEXE" $BOINCOPTS --dir $BOINCDIR >>$LOGFILE 2>>$ERRORLOG &
- try=0
- while [ $try -lt 10 ] ; do
- PID=`pidof -s -x -o $$ -o $PPID -o %PPID $BOINCEXE`
- if [ $PID ]; then
- touch $LOCKFILE && echo_success || echo_failure
- break
- else
- sleep 1
- fi
- let try+=1
+ # Check that boinc is running, give it a few tries
+ TRY=0
+ while [ $TRY -lt 10 ] ; do
+ check_status >& /dev/null && { touch $LOCKFILE; success; echo; return; } || sleep 1
+ let TRY+=1
done;
- if [ -z $PID ]; then
- echo_failure
- fi
- echo
- ;;
+ check_status >& /dev/null && { touch $LOCKFILE; success; } || failure
+ echo
+}
+
+stop() {
+ cd $BOINCDIR
+ check_status >& /dev/null || exit 0
+ echo -n $"Stopping $prog: "
+ killproc -d 10 $BOINCEXE
+ rm -f $LOCKFILE
+ echo
+}
+
+reload() {
+ check_status >& /dev/null || { start; exit; }
+ action "Reading configuration: " $BOINCCMD --read_cc_config
+}
+
+restart() {
+ stop
+ start
+}
+
+case "$1" in
+ start)
+ $1
+ ;;
stop)
- cd $BOINCDIR
- if [ ! -f lockfile -a ! -f $LOCKFILE ] ; then
- echo -n "BOINC is not running (no lockfiles found)."
- echo_success
- else
- echo -n "Stopping BOINC client daemon: "
- killproc $BOINCEXE && echo_success || echo_failure
- # clean up in any case
- rm -f $BOINCDIR/lockfile
- rm -f $LOCKFILE
- fi
- echo
- ;;
+ $1
+ ;;
reload)
- if [ ! -f lockfile -a ! -f $LOCKFILE ] ; then
- echo -n "BOINC is not running (no lockfiles found) -- starting service."
- $0 start
- else
- echo -n "Reading configuration: "
- $BOINCCMD --read_cc_config >>$LOGFILE 2>>$ERRORLOG && echo_success || echo_failure
- fi
- echo
+ $1
+ ;;
+ restart)
+ $1
;;
force-reload)
- $0 reload
- $0 restart
- ;;
+ reload
+ restart
+ ;;
condrestart|try-restart)
- $0 status || exit 0
- $0 restart
- ;;
- restart)
- $0 stop
- $0 start
- ;;
-
+ check_status || exit 0
+ restart
+ ;;
status)
- PID=`pidof -x -o $$ -o $PPID -o %PPID boinc_client`
- if [ "$PID" == "" ]; then
- PID=`pidof -x -o $$ -o $PPID -o %PPID $BOINCEXE`
- fi
- if [ "$PID" != "" ]; then
- echo "BOINC client is running (pid $PID)."
- else
- if [ -f $BOINCDIR/lockfile -o -f $LOCKFILE ]; then
- echo "BOINC is stopped but lockfile(s) exist."
- exit 2
- else
- echo "BOINC client is stopped."
- exit 3
- fi
- fi
- ;;
-
+ check_status
+ ;;
*)
- echo "Usage: boinc {start|stop|restart|condrestart|try-restart|reload|force-reload|status}"
+ echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
exit 2
esac
-exit
-
-#EOF#
+exit $?
Index: boinc-client.spec
===================================================================
RCS file: /cvs/pkgs/rpms/boinc-client/F-10/boinc-client.spec,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- boinc-client.spec 10 Mar 2009 15:51:51 -0000 1.24
+++ boinc-client.spec 18 Mar 2009 10:33:42 -0000 1.25
@@ -4,7 +4,7 @@
Summary: The BOINC client core
Name: boinc-client
Version: 6.4.7
-Release: 3.r%{revision}svn%{?dist}
+Release: 5.r%{revision}svn%{?dist}
License: LGPLv2+
Group: Applications/Engineering
URL: http://boinc.berkeley.edu/
@@ -189,11 +189,11 @@
# Otherwise pull \$BOINCDIR from the init script
if [ -z \$BOINCDIR ]; then
- BOINCDIR="\`grep 'BOINCDIR=' %{_sysconfdir}/init.d/%{name} | sed 's|BOINCDIR=||'\`";
+ BOINCDIR=\`grep 'BOINCDIR=' %{_sysconfdir}/init.d/%{name} | tr '"' ' ' | sed 's|BOINCDIR=||'\`;
fi
cd \$BOINCDIR
-boinc_gui
+boinc_gui >& /dev/null
EOF
chmod a+x boincmgr
popd
@@ -313,6 +313,14 @@
%{_includedir}/boinc/*
%changelog
+* Tue Mar 17 2009 Milos Jakubicek <xjakub at fi.muni.cz> - 6.4.7-5.r17542svn
+- Wait longer when checking start/stop result in the init script.
+
+* Wed Mar 11 2009 Milos Jakubicek <xjakub at fi.muni.cz> - 6.4.7-4.r17542svn
+- Rewritten init script: honours localisation, fixed reload action, doesn't
+ output garbage into logfiles (resolves BZ#489378), do not leave stale init
+ script process on startup, uses /etc/init.d/functions instead of own stuff.
+
* Tue Mar 10 2009 Milos Jakubicek <xjakub at fi.muni.cz> - 6.4.7-3.r17542svn
- Fix damn typos in boincmgr wrapper script (resolves BZ#489463).
- Previous message (by thread): rpms/gimp/F-9 .cvsignore, 1.48, 1.49 gimp.spec, 1.171, 1.172 sources, 1.48, 1.49
- Next message (by thread): rpms/boinc-client/F-9 boinc-client-init-d, 1.6, 1.7 boinc-client.spec, 1.18, 1.19
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list