diff options
author | Dirk Meyer <dinoex@FreeBSD.org> | 2003-06-01 05:47:53 +0000 |
---|---|---|
committer | Dirk Meyer <dinoex@FreeBSD.org> | 2003-06-01 05:47:53 +0000 |
commit | fb617194c161cbd1170c0f4bf81bd61a14a281f7 (patch) | |
tree | 8ce8497962381723e51ed5302164500fff0434b5 /astro/setiathome | |
parent | 9951bae48cf8f7af34c4befe8482b992ed9098b5 (diff) | |
download | ports-fb617194c161cbd1170c0f4bf81bd61a14a281f7.tar.gz ports-fb617194c161cbd1170c0f4bf81bd61a14a281f7.zip |
Notes
Diffstat (limited to 'astro/setiathome')
-rw-r--r-- | astro/setiathome/files/setiathome.bin | 284 |
1 files changed, 0 insertions, 284 deletions
diff --git a/astro/setiathome/files/setiathome.bin b/astro/setiathome/files/setiathome.bin index 3aff3acff02b..9e4a54c69670 100644 --- a/astro/setiathome/files/setiathome.bin +++ b/astro/setiathome/files/setiathome.bin @@ -140,287 +140,3 @@ done while [ -n "${setipids}" ]; do wait done -#!/bin/sh -T - -# $FreeBSD$ - -# Copyright (c) 2003 Cyrille Lefevre. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. The name of the authors and contributors may not be used to -# endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS -# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. - -setistart () { # dir - local dir - dir=$1 - - # goto the startup dir - cd ${dir} || return - - # don't start a dying client - [ -f stop_after_send.txt ] && return - - # fire up a setiathome client - ${program_path} ${program_args} > /dev/null & - - # memorize the startup dir - eval pid_$!=${dir} - # and the client process ID - setipids="${setipids} $!" -} - -setikill () { # SIGTERM handler - local pids pid - - # save pids to kill - pids="${sleeppid} ${setipids}" - # avoid futher setiathome startup - unset setipids - - # kill'em all if any - for pid in ${pids}; do - ps p ${pid} > /dev/null && kill ${pid} - done -} - -setirestart () { # SIGCHLD handler - local pids pid dir - - # killing in progress - [ -n "${setipids}" ] || return - # restart in process - [ -n "${sleeppids}" ] && return - - # wait for setiathome servers to come up - sleep ${seti_sleep_time} & - - # wait even if more than one setiathome client dies - sleeppid=$! - while ps p ${sleeppid} > /dev/null; do - wait ${sleeppid} - done - unset sleeppid - - # killing while sleeping - [ -n "${setipids}" ] || return - - # save pids to restart - pids=${setipids} - # reset the process ID list - unset setipids - - for pid in ${pids}; do - if ps p ${pid} > /dev/null; then - # still alive - setipids="${setipids} ${pid}" - else - # backup the startup dir - eval dir=\${pid_${pid}} - # clean the old one - unset pid_${pid} - # launch the dead client - eval setistart ${dir} - fi - done -} - -if [ -z "${program_path}" ]; then - case $0 in - /*) rc_dir=${0%/*} ;; - *) rc_dir=${PWD:-$(pwd)} ;; - esac - rc_file=${0##*/} - rc_path=${rc_dir}/${rc_file} - - if ! PREFIX=$(expr ${rc_path} : "\(/.*\)/libexec/${rc_file}\$"); then - echo "${rc_file}: Cannot determine PREFIX." >&2 - echo "Please use the complete pathname." >&2 - exit 64 - fi - - echo "Don't use this script directly, uses the following one instead :" >&2 - echo " ${PREFIX}/etc/rc.d/${rc_file%.bin}.sh start" >&2 - exit 1 -fi - -# save this shell process ID -echo $$ > ${seti_wrkdir}/shpid.sah - -# setup handlers -trap setikill TERM -trap setirestart CHLD - -# startup setiathome client(s) -for dir in ${seti_wrksuff}; do - setistart ${seti_wrkdir}/${dir} -done - -# wait for them until death -while [ -n "${setipids}" ]; do - wait -done -#!/bin/sh -T - -# $FreeBSD$ - -# Copyright (c) 2003 Cyrille Lefevre. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. The name of the authors and contributors may not be used to -# endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS -# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. - -setistart () { # dir - local dir - dir=$1 - - # goto the startup dir - cd ${dir} || return - - # don't start a dying client - [ -f stop_after_send.txt ] && return - - # fire up a setiathome client - ${program_path} ${program_args} > /dev/null & - - # memorize the startup dir - eval pid_$!=${dir} - # and the client process ID - setipids="${setipids} $!" -} - -setikill () { # SIGTERM handler - local pids pid - - # save pids to kill - pids="${sleeppid} ${setipids}" - # avoid futher setiathome startup - unset setipids - - # kill'em all if any - for pid in ${pids}; do - ps p ${pid} > /dev/null && kill ${pid} - done -} - -setirestart () { # SIGCHLD handler - local pids pid dir - - # killing in progress - [ -n "${setipids}" ] || return - # restart in process - [ -n "${sleeppids}" ] && return - - # wait for setiathome servers to come up - sleep ${seti_sleep_time} & - - # wait even if more than one setiathome client dies - sleeppid=$! - while ps p ${sleeppid} > /dev/null; do - wait ${sleeppid} - done - unset sleeppid - - # killing while sleeping - [ -n "${setipids}" ] || return - - # save pids to restart - pids=${setipids} - # reset the process ID list - unset setipids - - for pid in ${pids}; do - if ps p ${pid} > /dev/null; then - # still alive - setipids="${setipids} ${pid}" - else - # backup the startup dir - eval dir=\${pid_${pid}} - # clean the old one - unset pid_${pid} - # launch the dead client - eval setistart ${dir} - fi - done -} - -if [ -z "${program_path}" ]; then - case $0 in - /*) rc_dir=${0%/*} ;; - *) rc_dir=${PWD:-$(pwd)} ;; - esac - rc_file=${0##*/} - rc_path=${rc_dir}/${rc_file} - - if ! PREFIX=$(expr ${rc_path} : "\(/.*\)/libexec/${rc_file}\$"); then - echo "${rc_file}: Cannot determine PREFIX." >&2 - echo "Please use the complete pathname." >&2 - exit 64 - fi - - echo "Don't use this script directly, uses the following one instead :" >&2 - echo " ${PREFIX}/etc/rc.d/${rc_file%.bin}.sh start" >&2 - exit 1 -fi - -# save this shell process ID -echo $$ > ${seti_wrkdir}/shpid.sah - -# setup handlers -trap setikill TERM -trap setirestart CHLD - -# startup setiathome client(s) -for dir in ${seti_wrksuff}; do - setistart ${seti_wrkdir}/${dir} -done - -# wait for them until death -while [ -n "${setipids}" ]; do - wait -done |