<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Thanks for the scripts<br>
    <br>
    but to be clearer - are these scripts to be used in Debian
    installations?<br>
    <br>
    thanks,<br>
    <br>
    On 25/05/12 10:21, Nicolas AGIUS wrote:
    <blockquote
      cite="mid:1337937698.59668.YahooMailClassic@web28404.mail.ukl.yahoo.com"
      type="cite">
      <meta http-equiv="Context-Type" content="text/html;
        charset=iso-8859-1">
      <table>
        <tbody>
          <tr>
            <td valign="top">Hi,<br>
              <br>
              Thanks for this code.<br>
              I've done some small improvement and added a script for
              OCCI.<br>
              <br>
              You can find them here :
              <a class="moz-txt-link-freetext" href="http://dev.opennebula.org/issues/1289">http://dev.opennebula.org/issues/1289</a><br>
              <br>
              Cheers,<br>
              Nicolas AGIUS<br>
              <br>
              --- En date de : <b>Dim 22.4.12, Francesco Camisa <i><a class="moz-txt-link-rfc2396E" href="mailto:francesco.camisa@policlinicosanmarco.it"><francesco.camisa@policlinicosanmarco.it></a></i></b>
              a écrit :<br>
              <blockquote><br>
                De: Francesco Camisa
                <a class="moz-txt-link-rfc2396E" href="mailto:francesco.camisa@policlinicosanmarco.it"><francesco.camisa@policlinicosanmarco.it></a><br>
                Objet: [one-users] sunstone-server and oneacctd CentOS
                init.d scripts<br>
                À: <a class="moz-txt-link-abbreviated" href="mailto:users@lists.opennebula.org">users@lists.opennebula.org</a><br>
                Date: Dimanche 22 avril 2012, 15h58<br>
                <br>
                <div>I find usefull to have sunstone-server and oneacctd
                  to start automatically.<br>
                  <br>
                  I have created the following scripts. They are rough
                  but do their job in my tests. Any input on improving
                  them is much appreciated.<br>
                  <br>
                  For oneacctd:<br>
                  <br>
                  #!/bin/bash<br>
                  #<br>
                  #    /etc/rc.d/init.d/oneacctd-d<br>
                  #<br>
                  # Starts the oneacctd daemon<br>
                  #<br>
                  # chkconfig: 345 66 34<br>
                  # description: Starts the oneacctd daemon<br>
                  # processname: oneacctd-d<br>
                  <br>
                  ### BEGIN INIT INFO<br>
                  # Provides: oneacctd-d<br>
                  # Required-Start: $local_fs $remote_fs oned<br>
                  # Required-Stop: $local_fs $remote_fs oned<br>
                  # Default-Start:  2 3 4 5<br>
                  # Default-Stop: 0 1 6<br>
                  # Short-Description: start and stop oneacctd-d<br>
                  # Description: start and stop oneacctd-d<br>
                  ### END INIT INFO<br>
                  <br>
                  ONEACCTD_BIN=/usr/bin/oneacctd<br>
                  prog=acctd.rb<br>
                  <br>
                  # Source function library.<br>
                  . /etc/rc.d/init.d/functions<br>
                  <br>
                  lockfile=/var/lock/subsys/$prog<br>
                  pidfile=/var/run/$prog.pid<br>
                  <br>
                  RETVAL=0<br>
                  <br>
                  check() {<br>
                      # Check that we're a privileged user<br>
                      [ `id -u` = 0 ] || exit 4<br>
                  <br>
                      # Check if oneacctd-d is executable<br>
                      test -x $ONEACCTD_BIN || exit 5<br>
                  }<br>
                  <br>
                  start() {<br>
                      check<br>
                      echo -n $"Starting oneacctd daemon: "<br>
                      daemon --user oneadmin $ONEACCTD_BIN start<br>
                      RETVAL=$?<br>
                      echo<br>
                      [ $RETVAL -eq 0 ] && touch $lockfile
                  && echo $(ps -ef|grep su[n]stone-server | awk
                  '{print $2}') > $pidfile<br>
                      return $RETVAL<br>
                  }<br>
                  <br>
                  stop() {<br>
                  <br>
                      check<br>
                  <br>
                      echo -n $"Stopping oneacctd daemon: "<br>
                      su oneadmin -s /bin/sh -c "$ONEACCTD_BIN stop"<br>
                      RETVAL=$?<br>
                      echo<br>
                      [ $RETVAL -eq 0 ] && rm -f $lockfile
                  && rm -f $pidfile<br>
                      return $RETVAL<br>
                  }<br>
                  <br>
                  restart() {<br>
                      stop<br>
                      start<br>
                  }<br>
                  <br>
                  <br>
                  case "$1" in<br>
                  start)<br>
                      start<br>
                      ;;<br>
                  stop)<br>
                      stop<br>
                      ;;<br>
                  restart)<br>
                      restart<br>
                      ;;<br>
                  status)<br>
                      status $prog<br>
                      RETVAL=$?<br>
                      ;;<br>
                  *)<br>
                      echo $"Usage: $0 {start|stop|status|restart}"<br>
                      RETVAL=2<br>
                  esac<br>
                  <br>
                  exit $RETVAL<br>
                  <br>
                  For sunstone-server:<br>
                  <br>
                  #!/bin/bash<br>
                  #<br>
                  #    /etc/rc.d/init.d/sunstoned<br>
                  #<br>
                  # Starts the Sunstone Server daemon<br>
                  #<br>
                  # chkconfig: 345 66 34<br>
                  # description: Starts the Sunstone Server daemon<br>
                  # processname: sunstoned<br>
                  <br>
                  ### BEGIN INIT INFO<br>
                  # Provides: sunstoned<br>
                  # Required-Start: $local_fs $remote_fs oned<br>
                  # Required-Stop: $local_fs $remote_fs oned<br>
                  # Default-Start:  2 3 4 5<br>
                  # Default-Stop: 0 1 6<br>
                  # Short-Description: start and stop sunstoned<br>
                  # Description: start and stop sunstoned<br>
                  ### END INIT INFO<br>
                  <br>
                  SUNSTONE_BIN=/usr/bin/sunstone-server<br>
                  prog=sunstone-server.rb<br>
                  <br>
                  # Source function library.<br>
                  . /etc/rc.d/init.d/functions<br>
                  <br>
                  lockfile=/var/lock/subsys/$prog<br>
                  pidfile=/var/run/$prog.pid<br>
                  <br>
                  RETVAL=0<br>
                  <br>
                  check() {<br>
                      # Check that we're a privileged user<br>
                      [ `id -u` = 0 ] || exit 4<br>
                  <br>
                      # Check if sunstoned is executable<br>
                      test -x $SUNSTONE_BIN || exit 5<br>
                  }<br>
                  <br>
                  start() {<br>
                      check<br>
                      echo -n $"Starting Sunstone Server daemon: "<br>
                      daemon --user oneadmin $SUNSTONE_BIN start<br>
                      RETVAL=$?<br>
                      echo<br>
                      [ $RETVAL -eq 0 ] && touch $lockfile
                  && echo $(ps -ef|grep su[n]stone-server | awk
                  '{print $2}') > $pidfile<br>
                      return $RETVAL<br>
                  }<br>
                  <br>
                  stop() {<br>
                  <br>
                      check<br>
                  <br>
                      echo -n $"Stopping Sunstone Server daemon: "<br>
                      su oneadmin -s /bin/sh -c "$SUNSTONE_BIN stop"<br>
                      RETVAL=$?<br>
                      echo<br>
                      [ $RETVAL -eq 0 ] && rm -f $lockfile
                  && rm -f $pidfile<br>
                      return $RETVAL<br>
                  }<br>
                  <br>
                  restart() {<br>
                      stop<br>
                      start<br>
                  }<br>
                  <br>
                  <br>
                  case "$1" in<br>
                  start)<br>
                      start<br>
                      ;;<br>
                  stop)<br>
                      stop<br>
                      ;;<br>
                  restart)<br>
                      restart<br>
                      ;;<br>
                  status)<br>
                      status $prog<br>
                      RETVAL=$?<br>
                      ;;<br>
                  *)<br>
                      echo $"Usage: $0 {start|stop|status|restart}"<br>
                      RETVAL=2<br>
                  esac<br>
                  <br>
                  exit $RETVAL<br>
                  <br>
                  <br>
                  Francesco Camisa<br>
                  Vice Direttore Generale<br>
                  Policlinico San Marco<br>
                  via Zanotto 40<br>
                  30173 Mestre-VE<br>
                  Italy<br>
                  _______________________________________________<br>
                  Users mailing list<br>
                  <a moz-do-not-send="true"
                    href="/mc/compose?to=Users@lists.opennebula.org">Users@lists.opennebula.org</a><br>
                  <a moz-do-not-send="true"
                    href="http://lists.opennebula.org/listinfo.cgi/users-opennebula.org">http://lists.opennebula.org/listinfo.cgi/users-opennebula.org</a><br>
                </div>
              </blockquote>
            </td>
          </tr>
        </tbody>
      </table>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opennebula.org">Users@lists.opennebula.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opennebula.org/listinfo.cgi/users-opennebula.org">http://lists.opennebula.org/listinfo.cgi/users-opennebula.org</a>
</pre>
    </blockquote>
  </body>
</html>