par stardust » 20 Juin 2003 11:00
Bonjour à tous,
<BR>
<BR>J'essaie de comprendre ce qui se passe losque la function start de ce script est appelée :
<BR>
<BR>
<BR>###########################################################################
<BR>#
<BR># Bourne shell functions for use with daemontools-0.70
<BR>#
<BR>###########################################################################
<BR>
<BR>#----------------------------------------------------------------------
<BR># copyright (C) 2001 e-smith, inc.
<BR>#
<BR># This program is free software; you can redistribute it and/or modify
<BR># it under the terms of the GNU General Public License as published by
<BR># the Free Software Foundation; either version 2 of the License, or
<BR># (at your option) any later version.
<BR>#
<BR># This program is distributed in the hope that it will be useful,
<BR># but WITHOUT ANY WARRANTY; without even the implied warranty of
<BR># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
<BR># GNU General Public License for more details.
<BR>#
<BR># You should have received a copy of the GNU General Public License
<BR># along with this program; if not, write to the Free Software
<BR># Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
<BR>USA
<BR>#
<BR># Technical support for this program is available from e-smith, inc.
<BR># Please visit our web site <!-- BBCode auto-link start --><a href="http://www.e-smith.com" target="_blank">www.e-smith.com</a><!-- BBCode auto-link end --> for details.
<BR>#----------------------------------------------------------------------
<BR>
<BR># Source in the RedHat initscripts functions
<BR>
<BR>. /etc/rc.d/init.d/functions
<BR>
<BR># Now add some of our own and override some of RedHat's functions.
<BR>
<BR>pid()
<BR>{
<BR> running $1 && (status $1 | /bin/awk '{print $4}' | /bin/sed -e
<BR>'s/)//')
<BR>}
<BR>
<BR>restart()
<BR>{
<BR> stop $1
<BR> start $1
<BR>}
<BR>
<BR>running()
<BR>{
<BR> if [ -n "$(status $1 | /bin/grep ': up (pid')" ]
<BR> then
<BR> return 0
<BR> else
<BR> return 1
<BR> fi
<BR>}
<BR>
<BR>sigalrm()
<BR>{
<BR> running $1 && /usr/local/bin/svc -a $1
<BR>}
<BR>
<BR>sigcont()
<BR>{
<BR> running $1 && /usr/local/bin/svc -c $1
<BR>}
<BR>
<BR>sighup()
<BR>{
<BR> running $1 && /usr/local/bin/svc -h $1
<BR>}
<BR>
<BR>sigint()
<BR>{
<BR> running $1 && /usr/local/bin/svc -i $1
<BR>}
<BR>
<BR>sigkill()
<BR>{
<BR> running $1 && /usr/local/bin/svc -k $1
<BR>}
<BR>
<BR>sigstop()
<BR>{
<BR> running $1 && /usr/local/bin/svc -p $1
<BR>}
<BR>
<BR>sigterm()
<BR>{
<BR> running $1 && /usr/local/bin/svc -t $1
<BR>}
<BR>
<BR>start()
<BR>{
<BR> /bin/echo -n "Starting $SERVICE:"
<BR> running $1 || (/usr/local/bin/svc -u $1; /bin/sleep 1)
<BR> running $1 && success "Starting $SERVICE" || failure "Starting
<BR>$SERVICE"
<BR> /bin/echo
<BR>}
<BR>
<BR>status()
<BR>{
<BR> /usr/local/bin/svstat $1
<BR>}
<BR>
<BR>stop()
<BR>{
<BR> /bin/echo -n "Stopping $SERVICE:"
<BR> running $1 && (/usr/local/bin/svc -d $1; /bin/sleep 1)
<BR> running $1 && failure "Stopping $SERVICE" || success "Stopping
<BR>$SERVICE"
<BR> /bin/echo
<BR>}
<BR>
<BR>
<BR>
<BR>Quelqu'un serait il me dire quelles est la différence entre :
<BR>
<BR>running $1 ||
<BR>
<BR>et
<BR>
<BR>running $1 &&
<BR>
<BR>
<BR>Je pense que
<BR>|| est un "ou" entre 2 actions
<BR>et que
<BR>&& est un "et" entre 2 actions
<BR>
<BR>Si j'ai bon, que font ces lignes :
<BR>
<BR>start() :
<BR>running $1 || (/usr/local/bin/svc -u $1; /bin/sleep 1)
<BR>
<BR>running()
<BR>if [ -n "$(status $1 | /bin/grep ': up (pid')" ]
<BR>
<BR>D'avance merci