[systemd-devel] Service should run with a certain User (solved, new problem)?
dietmar.kling at web.de
Sat Apr 23 01:22:46 PDT 2011
I am embarrassed to answer myself after hitting the send button.
Of course i should not have put "test.sh" in /root , because the
user has no rights to access it...
It works now - but now the stopping the service seems a problem.
It always goes to failed because the java vm seems to provide a status=143
Loaded: loaded (/lib/systemd/system/cruisctl.service)
Process: 4811 ExecStart=/usr/bin/java $CRUISCTLOPTIONS
Regards (and hoping that the solution will also come to me when i hit
the send button)
Here is the working script:
# in directory /lib/systemd/system
Am 23.04.2011 10:03, schrieb Baldur:
> Hi all,
> after doing the simple examples of .service scripts, i was able to run
> some of my
> home-brewn services with fedora 15 beta.
> However now i tried something advanced (?) and i have to admit
> defeat. I have
> simply no idea how to proceed.
> I used to run with upstart a script with an "ugly" solution to do
> something like that
> su cruisctl -c "servicescript.sh"
> This was not pretty, however the script did run under the wanted user.
> Now i tried the same thing with systemd. It worked if tried the ugly
> I found that systemd has thee User= option, so i tried to avoid the su
> and start the
> script with systemed. But the service doesn't start
> when i set the "User=" option, it always returns a 203 error.
> Can somebody tell me what i am doing wrong?
> Here is my test setup
> Description=Cruise Control
> After=local-fs.target network.target
> #ExecStart=/usr/bin/java $CRUISCTLOPTIONS
> ExecStart=/root/test.sh $CRUISCTLOPTIONS
> The test.sh looks like this
> echo "Start" >/tmp/x
> echo Directory: $(pwd) >>/tmp/x
> echo Ant Home: $ANT_HOME >>/tmp/x
> echo $1 $2 $3 $4 $5 $6 >>/tmp/x
> sleep 60
> Error is like that
> cruisctl.service - Cruise Control
> Loaded: loaded (/lib/systemd/system/cruisctl.service)
> Active: failed
> Process: 4313 ExecStart=/root/test.sh $CRUISCTLOPTIONS
> (code=exited, status=203/EXEC)
> CGroup: name=systemd:/system/cruisctl.service
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
More information about the systemd-devel