Re: Silent or move to /dev/null alsactl restore out

Hoël Bézier <[email protected]> Sat, 30 Nov 2024 12:59:43 +0100
Newsgroups gmane.comp.sysutils.supervision.general
Message-ID <Z0r-L4r6IrPMgl6m@sparta>
Am Sa, Nov 30, 2024 am 10:19:11 +0000 schrieb Laurent Bercot:
> > $ cat /etc/s6/sv/alsa/up
> > #!/bin/execlineb -P
> > if -t { test -e /var/lib/alsa/asound.state }
> > fdmove -c 2 1
> > exec alsactl restore
>
> [snip]
>  - Your up script is behaving differently depending on whether the
>result of the test is true or false. The "alsactl restore" command
>may or may not be called, depending on an external property (whether
>the asound.state file exists or not). This means that your machine
>state after boot is not guaranteed; this is generally a bad idea.

Sure, but what if the “alsactl restore” command depends on 
/var/lib/alsa/asound.state existing to run properly? Although this adds a race 
condition to the script, it seems better to me than using “foreground { … }” 
because one may not want to ignore all errors that may be raised by the 
command.

Hoël
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEElZjiR4iQkYjVEGdt6jPCPrF3Nk0FAmdK/i8ACgkQ6jPCPrF3
Nk2mxg/9F5sE1hQUx1K7WksvdIM6RGDouVMvrQ6l0Hcd/HQEBykI0N0WS6bJPMXx
9xjta5sFmBiFQFaaDBJ12+oQ5iSvM76sc988XFj9Am+2Z0kuraM0BsSg4O1EN0Z9
OMVSva4zq9QKiZJs0t/MPTqheZlnScsMyCTXgw1rEwRh8Pz1FxHh2antznj943Bs
mONf3p+D8sNUYK0LNAE198UWajGA16iyEovHGkbeCNpWxox0NEL3UVYjAFb4HpyR
ORTLWwYC88vFbJJ6DqmVwCLpwMv7/UEr+tSPoC7m5bD22hFde5FKMVmA4llGDQq8
gYqjiNKyvlWc9m2wfsjJusM4LOQv7tDeZFVA+wl1FjZG1DPu5d+iTLUp38LelYEz
eQgC0b4fWCT3hU2X2pcQ/YuhoyQXyigsZcn0b/UczdDjc5buCqlq1Fw447mq4DHD
6Yu/ZbK9v0CKD1qnLza37JJ7BzNsXVsGZ8yuyM9cwfDtygU/pZE3FSFJZLIV9HhL
iOZ5VeAftv5oOqe7S7Iw13jzZq+P8MaF8242GnCblwFNprl+EMGDICep2QYTa8ii
g69rUCJwX7qcr0CsKBgW6ivYd80fj4qj/ICBWMar45dlzR/vn7D0qkom7JRzSAfM
s4KRnEmFooCO3JentMVhpiU7iwJnNuuy+70kVNSCAkQgBn6iF5c=
=Fb/k
-----END PGP SIGNATURE-----