[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: systemd and bash scripts



De: "tand.read" <tand.read@yahoo.com>

> I am testing my own systemd unit (a service) that has this
> [service] section:

> Type=oneshot
>
> RemainAfterExit=yes
> ExecStart=/root/bin/mytest.sh start
> ExecStop=/bin/echo /root/bin/mytest.sh stop
>
> ("Want="-ed by multi-user.target and "After=" local-fs.target)
> and I try it out with systemctl start/stop-ing it when the
> system is fully on the ExecStop works fine, showing in
> journalctl, but ExecStart does nothing (not a single line in
> journal), and systemctl status shows it as "loaded" and
> "active (exited)", but not a single line of the mytest.sh
> script has run
>
> The only difference I see with ExecStart and ExecStop is that
> the stop-one calls a binary (and works) while the start-one
> calls a script (and goes to the bitbucket). Is there any
> shadowy setting that causes systemd NOT to run bash scripts as
> Exec* directives?

Does mytest.sh have sane permissions (chmod 755) ?

Is it placed where systemd can access it ? Does it work better
when it's in /tmp or some such ?

Do

  ExecStart=bash /root/bin/mytest.sh start

or

  ExecStart=/bin/bash /root/bin/mytest.sh start

work any better ?


Reply to: