<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#ffffff">
    <div class="moz-text-flowed" style="font-family: -moz-fixed;
      font-size: 14px;" lang="x-western">Hi,
      <br>
      <br>
      I am embarrassed to answer myself after hitting the send button.
      <br>
      Of course i should not have put "test.sh" in /root , because the
      <br>
      user has no rights to access it...
      <br>
      <br>
      It works now - but now the stopping the service seems a problem.
      <br>
      It always goes to failed because the java vm seems to provide&nbsp; a
      status=143
      <br>
      <br>
      Loaded: loaded (/lib/systemd/system/cruisctl.service)
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Active: failed
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Process: 4811 ExecStart=/usr/bin/java $CRUISCTLOPTIONS
      (code=exited, status=143)
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CGroup: name=systemd:/system/cruisctl.service
      <br>
      <br>
      <br>
      Regards&nbsp; (and hoping that the solution will also come to me when i
      hit the send button)
      <br>
      <br>
      <br>
      Here is the working script:
      <br>
      <br>
      #
      <br>
      # Install
      <br>
      # in directory /lib/systemd/system
      <br>
      <br>
      [Unit]
      <br>
      Description=Cruise Control
      <br>
      After=local-fs.target network.target
      <br>
      <br>
      [Service]
      <br>
      Type=simple
      <br>
      EnvironmentFile=/etc/sysconfig/cruisctl
      <br>
      User=cruisctl
      <br>
      WorkingDirectory=/var/cruisecontrol
      <br>
      ExecStart=/usr/bin/java $CRUISCTLOPTIONS
      <br>
      #ExecStart=/tmp/test.sh $CRUISCTLOPTIONS
      <br>
      <br>
      <br>
      <br>
      [Install]
      <br>
      WantedBy=multi-user.target
      <br>
      <br>
      <br>
      <br>
      <br>
      Am 23.04.2011 10:03, schrieb Baldur:
      <br>
      <blockquote type="cite" style="color: rgb(0, 0, 0);">Hi all,
        <br>
        <br>
        after doing the simple examples of .service scripts, i was able
        to run some of my
        <br>
        home-brewn&nbsp; services with fedora 15 beta.
        <br>
        <br>
        However now i tried something advanced (?)&nbsp; and i have to admit
        defeat. I have
        <br>
        simply no idea how to proceed.
        <br>
        <br>
        I used to run with upstart a script with an "ugly" solution&nbsp; to&nbsp;
        do something like that
        <br>
        &nbsp;&nbsp;&nbsp; su cruisctl -c "servicescript.sh"
        <br>
        <br>
        This was not pretty, however the script did run under the wanted
        user.
        <br>
        <br>
        Now i tried the same thing with systemd. It worked if tried the
        ugly solution.
        <br>
        <br>
        I found that systemd has thee User= option, so i tried to avoid
        the su and start the
        <br>
        script with systemed.&nbsp;&nbsp; But the service doesn't start
        <br>
        when i set the "User=" option, it always returns a 203 error.
        <br>
        <br>
        <br>
        Can somebody tell me what i am doing wrong?
        <br>
        <br>
        Here is my test setup
        <br>
        <br>
        <br>
        [Unit]
        <br>
        Description=Cruise Control
        <br>
        After=local-fs.target network.target
        <br>
        <br>
        [Service]
        <br>
        Type=simple
        <br>
        EnvironmentFile=/etc/sysconfig/cruisctl
        <br>
        User=cruisctl
        <br>
        WorkingDirectory=/var/cruisecontrol
        <br>
        #ExecStart=/usr/bin/java $CRUISCTLOPTIONS
        <br>
        ExecStart=/root/test.sh $CRUISCTLOPTIONS
        <br>
        <br>
        [Install]
        <br>
        WantedBy=multi-user.target
        <br>
        <br>
        <br>
        The test.sh looks like this
        <br>
        <br>
        #!/bin/sh
        <br>
        echo "Start" &gt;/tmp/x
        <br>
        echo Directory: $(pwd) &gt;&gt;/tmp/x
        <br>
        echo Ant Home: $ANT_HOME &gt;&gt;/tmp/x
        <br>
        echo $1 $2 $3 $4 $5 $6 &gt;&gt;/tmp/x
        <br>
        <br>
        sleep 60
        <br>
        <br>
        <br>
        Error is like that
        <br>
        cruisctl.service - Cruise Control
        <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Loaded: loaded (/lib/systemd/system/cruisctl.service)
        <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Active: failed
        <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Process: 4313 ExecStart=/root/test.sh $CRUISCTLOPTIONS
        (code=exited, status=203/EXEC)
        <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CGroup: name=systemd:/system/cruisctl.service
        <br>
        <br>
        <br>
        <br>
        <br>
        <br>
        _______________________________________________
        <br>
        systemd-devel mailing list
        <br>
        <a class="moz-txt-link-abbreviated"
          href="mailto:systemd-devel@lists.freedesktop.org">systemd-devel@lists.freedesktop.org</a>
        <br>
        <a class="moz-txt-link-freetext"
          href="http://lists.freedesktop.org/mailman/listinfo/systemd-devel">http://lists.freedesktop.org/mailman/listinfo/systemd-devel</a>
        <br>
        <br>
      </blockquote>
      <br>
      <br>
      <br>
    </div>
    <br>
    <br>
    Am 23.04.2011 10:03, schrieb Baldur:
    <blockquote cite="mid:4DB287D9.8070101@email.de" type="cite">Hi all,
      <br>
      <br>
      after doing the simple examples of .service scripts, i was able to
      run some of my
      <br>
      home-brewn&nbsp; services with fedora 15 beta.
      <br>
      <br>
      However now i tried something advanced (?)&nbsp; and i have to admit
      defeat. I have
      <br>
      simply no idea how to proceed.
      <br>
      <br>
      I used to run with upstart a script with an "ugly" solution&nbsp; to&nbsp;
      do something like that
      <br>
      &nbsp;&nbsp;&nbsp; su cruisctl -c "servicescript.sh"
      <br>
      <br>
      This was not pretty, however the script did run under the wanted
      user.
      <br>
      <br>
      Now i tried the same thing with systemd. It worked if tried the
      ugly solution.
      <br>
      <br>
      I found that systemd has thee User= option, so i tried to avoid
      the su and start the
      <br>
      script with systemed.&nbsp;&nbsp; But the service doesn't start
      <br>
      when i set the "User=" option, it always returns a 203 error.
      <br>
      <br>
      <br>
      Can somebody tell me what i am doing wrong?
      <br>
      <br>
      Here is my test setup
      <br>
      <br>
      <br>
      [Unit]
      <br>
      Description=Cruise Control
      <br>
      After=local-fs.target network.target
      <br>
      <br>
      [Service]
      <br>
      Type=simple
      <br>
      EnvironmentFile=/etc/sysconfig/cruisctl
      <br>
      User=cruisctl
      <br>
      WorkingDirectory=/var/cruisecontrol
      <br>
      #ExecStart=/usr/bin/java $CRUISCTLOPTIONS
      <br>
      ExecStart=/root/test.sh $CRUISCTLOPTIONS
      <br>
      <br>
      [Install]
      <br>
      WantedBy=multi-user.target
      <br>
      <br>
      <br>
      The test.sh looks like this
      <br>
      <br>
      #!/bin/sh
      <br>
      echo "Start" &gt;/tmp/x
      <br>
      echo Directory: $(pwd) &gt;&gt;/tmp/x
      <br>
      echo Ant Home: $ANT_HOME &gt;&gt;/tmp/x
      <br>
      echo $1 $2 $3 $4 $5 $6 &gt;&gt;/tmp/x
      <br>
      <br>
      sleep 60
      <br>
      <br>
      <br>
      Error is like that
      <br>
      cruisctl.service - Cruise Control
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Loaded: loaded (/lib/systemd/system/cruisctl.service)
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Active: failed
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Process: 4313 ExecStart=/root/test.sh $CRUISCTLOPTIONS
      (code=exited, status=203/EXEC)
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CGroup: name=systemd:/system/cruisctl.service
      <br>
      <br>
      <br>
      <br>
      <br>
      <br>
      _______________________________________________
      <br>
      systemd-devel mailing list
      <br>
      <a class="moz-txt-link-abbreviated" href="mailto:systemd-devel@lists.freedesktop.org">systemd-devel@lists.freedesktop.org</a>
      <br>
      <a class="moz-txt-link-freetext" href="http://lists.freedesktop.org/mailman/listinfo/systemd-devel">http://lists.freedesktop.org/mailman/listinfo/systemd-devel</a>
      <br>
      <br>
    </blockquote>
    <br>
  </body>
</html>