mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-25 04:43:33 +00:00
- Added support for SMP systems to etc/rc.d/setiathome.sh
- Added etc/setiathome.conf with options to set the nice level, the max. number of processes to run, the working directory, and the the user id to run as. - setiathome.1 was missing from Makefile (and +CONTENTS subsequently) - Updated the man page to reflect the changes.
This commit is contained in:
parent
4102f5d58e
commit
649d8f8c94
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=18877
@ -3,7 +3,7 @@
|
||||
# Date created: 22 Apr 1999
|
||||
# Whom: stb@freebsd.org
|
||||
#
|
||||
# $Id: Makefile,v 1.8 1999/05/17 08:18:01 stb Exp $
|
||||
# $Id: Makefile,v 1.9 1999/05/17 10:58:07 stb Exp $
|
||||
#
|
||||
|
||||
PKGNAME= setiathome-1.1
|
||||
@ -20,6 +20,8 @@ EXTRACT_CMD= tar
|
||||
EXTRACT_BEFORE_ARGS= -xf
|
||||
EXTRACT_AFTER_ARGS=
|
||||
|
||||
MAN1= setiathome.1
|
||||
|
||||
.include <bsd.port.pre.mk>
|
||||
|
||||
.if ${OSVERSION} >= 400000
|
||||
@ -69,6 +71,7 @@ pre-fetch:
|
||||
|
||||
do-install:
|
||||
${INSTALL_PROGRAM} ${WRKDIR}/${WRKSRC}/setiathome ${PREFIX}/bin
|
||||
${INSTALL_SCRIPT} ${FILESDIR}/setiathome.sh ${PREFIX}/etc/rc.d
|
||||
${INSTALL_MAN} ${FILESDIR}/setiathome.1 ${MAN1PREFIX}/man/man1
|
||||
|
||||
post-install:
|
||||
|
@ -1,5 +1,6 @@
|
||||
.\" Copyright status unkown
|
||||
.Dd April 19, 1999
|
||||
.\" $Id$
|
||||
.Dd May 19, 1999
|
||||
.Dt setiathome 1 LOCAL
|
||||
.Os FreeBSD
|
||||
.Sh NAME
|
||||
@ -10,7 +11,9 @@
|
||||
.Op Ar options
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
is the UNIX version of the
|
||||
is the
|
||||
.Ux
|
||||
version of the
|
||||
.Tn SETI@home
|
||||
client. It downloads radio telescope data from a network server, analyzes
|
||||
the data looking for signals of extraterrestrial origin, and uploads results
|
||||
@ -33,32 +36,72 @@ if you like.
|
||||
can be freely aborted and restarted. It saves its state in files,
|
||||
and will pick up where it left off.
|
||||
.Pp
|
||||
If you want to run multiple instances of setiathome
|
||||
(on a multiprocessor machine, or on multiple machines
|
||||
that share a filesystem) each one must be run
|
||||
in a different directory.
|
||||
.Pp
|
||||
.Nm
|
||||
requires about 0.5\ MBytes of disk space in it's working directory, and about
|
||||
12\ MBytes of memory. If you have ample physical memory, it's work load
|
||||
should be almost undetectable.
|
||||
requires about 0.5\ MBytes of disk space per working directory, and about
|
||||
12\ MBytes of memory per instance. If you have ample physical memory, it's work load
|
||||
should be almost undetectable. Additionally,
|
||||
.Nm
|
||||
requires a permanent or
|
||||
.Dq dial on demand
|
||||
Internet connection to upload results to and download new work units from the
|
||||
.Tn SETI@home
|
||||
server at any time.
|
||||
.Ss Starting setiathome
|
||||
This port to FreeBSD includes a start-up script (usually found in
|
||||
.Pa /usr/local/etc/rc.d/setiathome.sh )
|
||||
that starts
|
||||
This
|
||||
.Fx
|
||||
port includes a start-up script that starts
|
||||
.Nm
|
||||
at system start-up. You can also use this script to set up a working
|
||||
directory
|
||||
.Pa ( /var/db/setiathome ) ,
|
||||
at system start-up.
|
||||
.Ss Configuration File
|
||||
The optional configuration file
|
||||
.Pa /usr/local/etc/setiathome.conf
|
||||
can contain one or more of the following variable assignments to override
|
||||
their default values:
|
||||
.Bl -tag -width seti_wrkdir
|
||||
.It Pa seti_wrkdir=/var/db/setiathome
|
||||
The working directory where
|
||||
.Nm
|
||||
will store it's temporary files.
|
||||
.It Pa seti_user=nobody
|
||||
The user to run
|
||||
.Nm
|
||||
as.
|
||||
.It Pa seti_nice=1
|
||||
The
|
||||
.Xr nice 1
|
||||
value to run
|
||||
.Nm
|
||||
as.
|
||||
.It Pa seti_maxprocs= Ns Va Number of CPUs
|
||||
The number of
|
||||
.Nm
|
||||
processes to run concurrently. Defaults to the number of CPUs installed.
|
||||
Running more than one instance per CPU is not useful, as
|
||||
.Nm
|
||||
is almost completely CPU-bound.
|
||||
.El
|
||||
.Pp
|
||||
If you change values in the configuration file, you need to stop and start
|
||||
.Nm Ns ,
|
||||
and possibly reconfigure the working directory for the changes to take
|
||||
effect. Run
|
||||
.Dl /usr/local/etc/rc.d/setiathome.sh stop
|
||||
.Dl /usr/local/etc/rc.d/setiathome.sh register
|
||||
.Dl /usr/local/etc/rc.d/setiathome.sh start
|
||||
to do that.
|
||||
.Ss Setting up setiathome
|
||||
You can use the start-up script to set up a working directory
|
||||
and register with or log in to
|
||||
.Tn SETI@home
|
||||
by calling it with the argument
|
||||
.Ar register .
|
||||
.Ss Setting up setiathome manually
|
||||
If you'd like to run
|
||||
.Nm
|
||||
on a SMP system, and therefor would like to run multiple
|
||||
.Nm
|
||||
processes at once, or would like it to run under a different user ID than
|
||||
.Sq nobody ,
|
||||
you have to set up one or more suitable working directories yourself.
|
||||
.Pp
|
||||
For each
|
||||
If you'd like to configure and run it manually, you should first disable the
|
||||
start-up script. Then, for each
|
||||
.Nm
|
||||
instance you'd like to run, create a directory, make it owned by the user
|
||||
you'd like to run
|
||||
@ -78,24 +121,31 @@ to
|
||||
.Ed
|
||||
to the user's crontab.
|
||||
.Sh OPTIONS
|
||||
.Bl -tag -width indent
|
||||
.It Fl login
|
||||
Login or create new account.
|
||||
.Bl -tag -width countries
|
||||
.It Fl countries
|
||||
Show list of country codes.
|
||||
.It Fl version
|
||||
Show software version
|
||||
.It Fl nice Ar N
|
||||
Set "nice" priority to
|
||||
.Ar N
|
||||
(default 1);
|
||||
Show list of country codes (a numeric country code must be entered during
|
||||
registration).
|
||||
.It Fl email
|
||||
Send email (to login email address) on errors. Useful if you run in
|
||||
background directed to
|
||||
Send email (to the email address registered with
|
||||
.Tn SETI@home )
|
||||
on errors. Useful if you run
|
||||
.Nm
|
||||
in the background with the output directed to
|
||||
.Pa /dev/null .
|
||||
.It Fl proxy Ar host:port
|
||||
.It Fl login
|
||||
Log in to or register with
|
||||
.Tn SETI@home .
|
||||
.It Fl nice Ar N
|
||||
Set
|
||||
.Xr nice 1
|
||||
priority to
|
||||
.Ar N
|
||||
(default 1).
|
||||
.It Fl proxy Va hostname Ns Xo
|
||||
.Op Li : Ns Va port
|
||||
.Xc
|
||||
Use the HTTP proxy server
|
||||
.Ar host
|
||||
.Ar hostname
|
||||
at port
|
||||
.Ar port
|
||||
to download work units and upload results. Alternatively, you can set the
|
||||
@ -105,25 +155,58 @@ environment variable
|
||||
Process the current work unit and exit before uploading the result.
|
||||
.It Fl stop_after_xfer
|
||||
Process the current work unit and upload the result, then exit.
|
||||
.It Fl version
|
||||
Show software version.
|
||||
.El
|
||||
.Sh ENVIRONMENT
|
||||
.Bl -tag -width HTTP_PROXY
|
||||
.It Ev HTTP_PROXY
|
||||
The address (in the form
|
||||
.Do Va hostname Ns
|
||||
.Op Li : Ns Va port
|
||||
.Dc )
|
||||
of a HTTP proxy server to download work units and upload results via.
|
||||
.El
|
||||
.Pp
|
||||
.Sh FILES
|
||||
The program generates several files with
|
||||
.Pa .txt
|
||||
extension in the directory from which it's run. These should not be
|
||||
modified.
|
||||
.Pp
|
||||
If you want to run multiple instances of setiathome
|
||||
(on a multiprocessor machine, or on multiple machines
|
||||
that share a filesystem) each one must be run
|
||||
in a different directory.
|
||||
.Bl -tag -width /var/db -compact
|
||||
.It Pa /var/db/setiathome/
|
||||
Primary working directory.
|
||||
.It Pa /var/db/setiathome/user_info.txt
|
||||
Registration data.
|
||||
.It Pa /var/db/setiathome/ Ns Va n Ns /
|
||||
Working directories for additional process
|
||||
.Va n
|
||||
(when running more than one instance).
|
||||
.It Pa /var/db/setiathome/ Ns Xo
|
||||
.Op Ns Va n Ns Li / Ns
|
||||
.Pa lock.txt
|
||||
.Xc
|
||||
Lock file to prevent multiple instances to work on the same data.
|
||||
.It Pa /var/db/setiathome/ Ns Xo
|
||||
.Op Ns Va n Ns Li / Ns
|
||||
.Pa *.txt
|
||||
.Xc
|
||||
Working files.
|
||||
.It Pa /usr/local/etc/rc.d/setiathome.sh
|
||||
Startup script.
|
||||
.Sh BUGS
|
||||
As of version 1.1, the proxy setting ignores the
|
||||
.Va port
|
||||
argument in both the option and the environment variable.
|
||||
.Pp
|
||||
setiathome uses a lock file
|
||||
.Pa ( lock.txt )
|
||||
to prevent multiple instances from running in the same directory.
|
||||
There is currently no easy way to run
|
||||
.Nm
|
||||
continuosly if you don't have a permanent or
|
||||
.Dq dial on demand
|
||||
Internet connection.
|
||||
.Sh AUTHORS
|
||||
.Tn SETI@home
|
||||
was developed by David Anderson, Jeff Cobb, Charles Congdon, Charlie Fenton,
|
||||
David Gedye, Kyle Granger, Eric Korpela, Matt Lebofsky, Peter Leiser, Brad
|
||||
Silen, Woody Sullivan, and Dan Werthimer.
|
||||
.Pp
|
||||
.An Stefan Bethke <stb@freebsd.org>
|
||||
amended the original manual page for this
|
||||
.Fx
|
||||
port.
|
||||
|
92
astro/setiathome/files/setiathome.sh
Normal file
92
astro/setiathome/files/setiathome.sh
Normal file
@ -0,0 +1,92 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Start or stop setiathome, or set up working directory and register
|
||||
#
|
||||
|
||||
# override these variables in ${PREFIX}/etc/setiathome.conf
|
||||
seti_wrkdir=/var/db/setiathome # primary working directory
|
||||
seti_user=nobody # user id to run as
|
||||
seti_nice=1 # nice level to run at
|
||||
seti_maxprocs=`sysctl -n hw.ncpu` # max. number of processes to start
|
||||
|
||||
PREFIX=/`expr $0 : '/\(.*\)/etc/rc.d/setiathome.sh'`
|
||||
if [ "x${PREFIX}" = "x/" ]; then
|
||||
printf "\n`basename $0`: Cannot determine PREFIX.\nPlease use the complete pathname." >&2
|
||||
exit 64
|
||||
fi
|
||||
|
||||
if [ -f ${PREFIX}/etc/setiathome.conf ]; then
|
||||
. ${PREFIX}/etc/setiathome.conf
|
||||
fi
|
||||
|
||||
i=${seti_maxprocs}
|
||||
seti_wrksuff="."
|
||||
while [ ${i} -gt 1 ]; do
|
||||
seti_wrksuff="${seti_wrksuff} ${i}"
|
||||
i=`expr ${i} - 1`
|
||||
done
|
||||
|
||||
case $1 in
|
||||
start)
|
||||
for i in ${seti_wrksuff}; do
|
||||
if [ ! -d ${seti_wrkdir}/${i} ]; then
|
||||
logger -sp daemon.err -t setiathome \
|
||||
"unable to start: ${seti_wrkdir}/${i} is missing."
|
||||
exit 72
|
||||
fi
|
||||
if [ ! -f ${seti_wrkdir}/${i}/user_info.txt ]; then
|
||||
logger -sp daemon.err -t setiathome \
|
||||
"unable to start: please log in to SETI@home first. (${seti_wrkdir}/${i}/user_info.txt is missing.)"
|
||||
exit 72
|
||||
fi
|
||||
done
|
||||
for i in ${seti_wrksuff}; do
|
||||
su -m ${seti_user} -c \
|
||||
"(cd ${seti_wrkdir}/${i} && exec ${PREFIX}/bin/setiathome -email -nice ${seti_nice} >/dev/null &)"
|
||||
echo -n " SETI@home"
|
||||
done
|
||||
;;
|
||||
|
||||
stop)
|
||||
killall setiathome
|
||||
;;
|
||||
|
||||
register)
|
||||
# Create or update primary working directory (in case the uid changed)
|
||||
mkdir -p ${seti_wrkdir}
|
||||
chown ${seti_user} ${seti_wrkdir}
|
||||
chmod u=Xrw,g=Xr,o=Xr ${seti_wrkdir}
|
||||
if [ -f ${seti_wrkdir}/user_info.txt ]; then
|
||||
echo " It seems you have already registered with SETI@home. Would you like"
|
||||
echo -n " to repeat the procedure? [Y/n] "
|
||||
read a
|
||||
if [ "X${a}" = "Xn" -o "X${a}" = "XN" ]; then
|
||||
seti_dontlogin=yes
|
||||
fi
|
||||
fi
|
||||
# No need to register if we've already done so
|
||||
if [ "X${seti_dontlogin}" != "Xyes" ]; then
|
||||
su -m ${seti_user} -c "cd ${seti_wrkdir} && ${PREFIX}/bin/setiathome -login"
|
||||
fi
|
||||
|
||||
if [ ${seti_maxprocs} -gt 1 ]; then
|
||||
echo " Updating additional working directories."
|
||||
i=${seti_maxprocs}
|
||||
while [ ${i} -gt 1 ]; do
|
||||
mkdir -p ${seti_wrkdir}/${i}
|
||||
chown ${seti_user} ${seti_wrkdir}/${i}
|
||||
chmod 755 ${seti_wrkdir}/${i}
|
||||
# Assume the user want's all processes to run with the same registration
|
||||
rm -f ${seti_wrkdir}/${i}/user_info.txt
|
||||
ln -sf ../user_info.txt ${seti_wrkdir}/${i}
|
||||
i=`expr ${i} - 1`
|
||||
done
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "usage: `basename $0` {start|stop|register}" >&2
|
||||
exit 64
|
||||
;;
|
||||
esac
|
@ -6,58 +6,42 @@
|
||||
|
||||
DBDIR=/var/db/setiathome
|
||||
RCD=${PKG_PREFIX}/etc/rc.d/setiathome.sh
|
||||
USER=nobody
|
||||
seti_wrkdir=/var/db/setiathome # working directory
|
||||
seti_user=nobody # user id to run under
|
||||
seti_nice=1 # nice level to run at
|
||||
seti_maxprocs=`sysctl -n hw.ncpu` # max. number of processes to start
|
||||
|
||||
if [ -f ${PKG_PREFIX}/etc/setiathome.conf ]; then
|
||||
. ${PKG_PREFIX}/etc/setiathome.conf
|
||||
fi
|
||||
|
||||
case $2 in
|
||||
POST-INSTALL)
|
||||
rm -f ${RCD}
|
||||
cat <<EOF >${RCD}
|
||||
#!/bin/sh
|
||||
|
||||
PREFIX=${PKG_PREFIX}
|
||||
DBDIR=${DBDIR}
|
||||
USER=${USER}
|
||||
|
||||
case \$1 in
|
||||
start)
|
||||
if [ ! -d \${DBDIR} ]; then
|
||||
logger -sp user.err -t setiathome "unable to start: \${DBDIR} is missing."
|
||||
exit 72
|
||||
fi
|
||||
if [ ! -f \${DBDIR}/user_info.txt ]; then
|
||||
logger -sp user.err -t setiathome "unable to start: please log in to SETI@home first."
|
||||
exit 72
|
||||
fi
|
||||
su -m \${USER} -c \
|
||||
"(cd \${DBDIR} && exec \${PREFIX}/bin/setiathome -email >/dev/null &)"
|
||||
echo -n " SETI@home"
|
||||
;;
|
||||
stop)
|
||||
killall setiathome
|
||||
;;
|
||||
register)
|
||||
mkdir -p \${DBDIR}
|
||||
chown \${USER} \${DBDIR}
|
||||
chmod 755 \${DBDIR}
|
||||
|
||||
su -m nobody -c "cd \${DBDIR} && \${PREFIX}/bin/setiathome -login"
|
||||
;;
|
||||
esac
|
||||
EOF
|
||||
chmod +x ${RCD}
|
||||
|
||||
if [ -n "${PACKAGE_BUILDING}" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "**** SETI@home requires a working directory for temporary files and"
|
||||
echo "**** setihome requires a working directory for temporary files and"
|
||||
echo " a brief registration process."
|
||||
echo
|
||||
echo " Would you like to set up a working directory in ${DBDIR},"
|
||||
echo " register with SETI@home, and let me arrange for SETI@home to be"
|
||||
echo -n " started automatically as user \`nobody' [Y/n]? "
|
||||
if [ ${seti_maxprocs} -gt 1 ]; then
|
||||
if [ `sysctl -n hw.ncpu` -eq ${seti_maxprocs} ]; then
|
||||
echo " register with SETI@home, and let me arrange for ${seti_maxprocs} setiathome"
|
||||
echo " processes (one for each of your `sysctl -n hw.ncpu` CPUs) to be started automatically"
|
||||
echo -n " as user \`${seti_user}' [Y/n]? "
|
||||
else
|
||||
echo " register with SETI@home, and let me arrange for ${seti_maxprocs} setiathome"
|
||||
echo " processes (as configured) to be started automatically"
|
||||
echo -n " as user \`${seti_user}' [Y/n]? "
|
||||
fi
|
||||
else
|
||||
echo " register with SETI@home, and let me arrange for setiathome to be"
|
||||
echo -n " started automatically as user \`${seti_user}' [Y/n]? "
|
||||
fi
|
||||
read a
|
||||
echo ""
|
||||
if [ "$a" = "N" -o "$a" = "n" ]; then
|
||||
if [ "X$a" = "XN" -o "X$a" = "Xn" ]; then
|
||||
echo ""
|
||||
echo "Please set up the working directory yourself. You can use"
|
||||
echo "${RCD} register"
|
||||
@ -80,3 +64,4 @@ EOF
|
||||
;;
|
||||
|
||||
esac
|
||||
exit 0
|
||||
|
Loading…
Reference in New Issue
Block a user