[systemd-devel] and again about conditions
Gustavo Sverzut Barbieri
barbieri at profusion.mobi
Fri May 20 10:40:10 PDT 2011
On Fri, May 20, 2011 at 12:42 PM, Alexey Shabalin <a.shabalin at gmail.com> wrote:
> I want to check settings before starting the service.
> Check only True or False.
>
> For example, i can only install mdadm package, but have not configured
> any raid disk. Then don't need run mdadm.service.
>
> mdadm.service
> [Unit]
> ConditionKernelCommandLine=|!noraidtab
> Condition... =| $(grep -qs
> '^[[:space:]]*\(MAILADDR\|PROGRAM\)[[:space:]]\+[^[:space:]]'
> /etc/mdadm.conf)
> Condition... =| $(grep -qs '^md[0-9]\+[[:space:]]*:' /proc/mdstat)
>
> or check in ExecStartPre and exit without run ExecStart
> [Service]
> ExecStartPre= grep -qs
> '^[[:space:]]*\(MAILADDR\|PROGRAM\)[[:space:]]\+[^[:space:]]'
> /etc/mdadm.conf || exit
I'd say this is insane.
For the specific mdadm case where admin needs to setup stuff, It's
clear that mdadm.service should be disabled by default and the admin
should setup it after he edited the configuration file (or some tool
that edits /etc/mdadm.conf should "systemctl enable mdadm.service").
For other cases I guess it's time to just rethink the whole mess
instead of cope with them.
--
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--------------------------------------
MSN: barbieri at gmail.com
Skype: gsbarbieri
Mobile: +55 (19) 9225-2202
More information about the systemd-devel
mailing list