<!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 a
status=143
<br>
<br>
Loaded: loaded (/lib/systemd/system/cruisctl.service)
<br>
Active: failed
<br>
Process: 4811 ExecStart=/usr/bin/java $CRUISCTLOPTIONS
(code=exited, status=143)
<br>
CGroup: name=systemd:/system/cruisctl.service
<br>
<br>
<br>
Regards (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 services with fedora 15 beta.
<br>
<br>
However now i tried something advanced (?) 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 to
do something like that
<br>
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. 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" >/tmp/x
<br>
echo Directory: $(pwd) >>/tmp/x
<br>
echo Ant Home: $ANT_HOME >>/tmp/x
<br>
echo $1 $2 $3 $4 $5 $6 >>/tmp/x
<br>
<br>
sleep 60
<br>
<br>
<br>
Error is like that
<br>
cruisctl.service - Cruise Control
<br>
Loaded: loaded (/lib/systemd/system/cruisctl.service)
<br>
Active: failed
<br>
Process: 4313 ExecStart=/root/test.sh $CRUISCTLOPTIONS
(code=exited, status=203/EXEC)
<br>
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 services with fedora 15 beta.
<br>
<br>
However now i tried something advanced (?) 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 to
do something like that
<br>
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. 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" >/tmp/x
<br>
echo Directory: $(pwd) >>/tmp/x
<br>
echo Ant Home: $ANT_HOME >>/tmp/x
<br>
echo $1 $2 $3 $4 $5 $6 >>/tmp/x
<br>
<br>
sleep 60
<br>
<br>
<br>
Error is like that
<br>
cruisctl.service - Cruise Control
<br>
Loaded: loaded (/lib/systemd/system/cruisctl.service)
<br>
Active: failed
<br>
Process: 4313 ExecStart=/root/test.sh $CRUISCTLOPTIONS
(code=exited, status=203/EXEC)
<br>
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>