Re: [systemd-devel] Starting service conditionally and retrying when failure

2017-10-05 Thread sdrb

Mantas Mikulėnas wrote:

On Thu, Oct 5, 2017 at 7:51 AM, sdrb <s...@onet.eu
<mailto:s...@onet.eu>> wrote:

Hi,

I'd like to ask how to achieve following functionality in systemd:

I'd like to start alsa-restore.service only once just after one of
the specified files appears. Those file matches: /dev/snd/control*.

For now I have something like this:

[Unit]
Description=Save/Restore Sound Card State
ConditionPathExistsGlob=/dev/snd/control*
After=sysinit.target

[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=-/sbin/alsactl restore -f /etc/asound.state

[Install]
WantedBy=multi-user.target


but during the start when there is no any of /dev/snd/control* files
- the condition is not meet and the service is not going up.
Those files appears later.

So that what I'd like to achieve is to wait for appearing of those
files and then starting alsa-restore service.


Isn't that exactly what ALSA's
standard /usr/lib/udev/rules.d/90-alsa-restore.rules does?




Thanks for all the responses. As I prefer the easiest solutions I have 
chosen Camilo's solution with serviced.path.

Problem fixed. Thanks.

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] Starting service conditionally and retrying when failure

2017-10-04 Thread sdrb

Hi,

I'd like to ask how to achieve following functionality in systemd:

I'd like to start alsa-restore.service only once just after one of the 
specified files appears. Those file matches: /dev/snd/control*.


For now I have something like this:

[Unit]
Description=Save/Restore Sound Card State
ConditionPathExistsGlob=/dev/snd/control*
After=sysinit.target

[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=-/sbin/alsactl restore -f /etc/asound.state

[Install]
WantedBy=multi-user.target


but during the start when there is no any of /dev/snd/control* files - 
the condition is not meet and the service is not going up.

Those files appears later.

So that what I'd like to achieve is to wait for appearing of those files 
and then starting alsa-restore service.


Is it possible to do in systemd? If yes - how to do this?

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] Minimal systemd configuration

2015-04-05 Thread sdrb

Hello,

I've got a few very basic questions regarding configuration of systemd.

I'm trying to setup some minimal configuration for qemu running linux.

The qemu runs linux kernel which mounts nfs-root as root directory.
I've made minimal nfs-root and now I'd like to start the system with 
systemd in it.
I copied all the files from /usr/lib/systemd and /etc/systemd from my 
linux to nfs-root but when linux runs systemd - I got a lot of error 
messages like [FAILED] Failed to start xxx service.


My questions are:

1. Is there any documentation for creating minimal systemd 
configuration? I mean for example - for qemu or embedded systems - with 
only sshd daemon running and console to just log into the system?


2. Does the systemd require external applications like mount, login or 
other to work properly?


3. Is it possible to reconfigure systemd to run some script at the end 
of initialisation?



sdrb
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel