systemd
Service warten lassen bei on-failure
Konkreter Fall: Exponat kann sich (nach Reboot der kompletten Ausstellung) nicht mit Broker verbinden, da der noch nicht da ist, und failt sofort. Darum:
[Service]
RestartSec = 60 # definiert, wie lange gewartet wird, zwischen stop und start
StartLimitBurst = 100 # so oft wird versucht, zu restarten, bevor aufgegeben wird
StartLimitInterval = 60 # in diesem Intervall darf so und so oft gestartet werden. Keine Ahnung, hab bisher einfach Sec und Burst multipliziert dafür
Aus laufendem System in Rescue Mode / "runlevel 1" wechseln
systemctl isolate rescue.target
Install Section richtig machen
Damit es mit systemctl enable und disable gesteuert werden kann:
Alias
Provides a space-separated list of additional names for the unit. Most systemctl commands, excluding systemctl enable, can use aliases instead of the actual unit name.
RequiredBy
A list of units that depend on the unit. When this unit is enabled, the units listed in RequiredBy gain a Require dependency on the unit.
WantedBy
A list of units that weakly depend on the unit. When this unit is enabled, the units listed in WantedBy gain a Want dependency on the unit.
Also
Specifies a list of units to be installed or uninstalled along with the unit.
DefaultInstance
Limited to instantiated units, this option specifies the default instance for which the unit is enabled. See Working with instantiated units.
Quelle: https://access.redhat.com/documentation/de-de/red_hat_enterprise_linux/8/html/configuring_basic_system_settings/assembly_working-with-systemd-unit-files_configuring-basic-system-settings#tabl-systemd-Install_Sec_Options
CIFS/SMB-Share als Mount-Unit für User
Geht nicht als User Service (das ginge nur mit setuid).
Unit-Filename muss den Mountpoint beinhalten. Das geht am besten mit systemd-escape:
$ systemd-escape --suffix=mount --path /mnt/pommes/music
mnt-pommes-music.mount
Dann kommt in /etc/systemd/system/mnt-pommes-music.mount:
[Unit]
Description=Mountet den Musikshare von Pommes nach /mnt/pommes/music
[Mount]
Type=cifs
What=//pommes.dreihack.internal/music
Where=/mnt/pommes/music
Options=rw,auto,credentials=/etc/samba/smbcredentials-pommes,uid=1000,gid=1000,dir_mode=0700
[Install]
WantedBy=multi-user.target
Auf dir-mode achten, damit niemand sonst das Share sehen kann. smbcredentials-File braucht das folgende Format:
username=bingus
password=abc123
und braucht natürlich chmod 600. Rausfinden ob das irgendwie besser geht, glaube es gibt Wege mit kerberos aber geht das auf nem Samba-Server überhaupt?