Blog di Un Utente Linux

systemd-service-dopo-mount

In questo articolo descrivo brevemente come imporre a un servizio di avviarsi dopo che una partizione presente nel file fstab sia stata montata.

Procedura

Usando il comando:

sudo systemctl list-units | grep mount 

un esempio tipico di output:

$ sudo systemctl list-units | grep mount
  proc-sys-fs-binfmt_misc.automount                                                         loaded active waiting   Arbitrary Executable File Formats File System Automount Point
  -.mount                                                                                   loaded active mounted   Root Mount
  boot-efi.mount                                                                            loaded active mounted   /boot/efi
  boot.mount                                                                                loaded active mounted   /boot
  dev-hugepages.mount                                                                       loaded active mounted   Huge Pages File System
  dev-mqueue.mount                                                                          loaded active mounted   POSIX Message Queue File System
  home.mount                                                                                loaded active mounted   /home
  run-user-1000-doc.mount                                                                   loaded active mounted   /run/user/1000/doc
  run-user-1000-gvfs.mount                                                                  loaded active mounted   /run/user/1000/gvfs
  run-user-1000.mount                                                                       loaded active mounted   /run/user/1000
  sys-fs-fuse-connections.mount                                                             loaded active mounted   FUSE Control File System
  sys-kernel-config.mount                                                                   loaded active mounted   Kernel Configuration File System
  sys-kernel-debug.mount                                                                    loaded active mounted   Kernel Debug File System
  sys-kernel-tracing.mount                                                                  loaded active mounted   Kernel Trace File System
  tmp.mount                                                                                 loaded active mounted   Temporary Directory (/tmp)
  var-lib-docker-btrfs.mount                                                                loaded active mounted   /var/lib/docker/btrfs
  var-lib-nfs-rpc_pipefs.mount                                                              loaded active mounted   RPC Pipe File System
  systemd-remount-fs.service                                                                loaded active exited    Remount Root and Kernel File Systems

Supponiamo di voler ritardare l’unità dopo il montaggio della partizione home, il file del servizio dovrà contenere la riga:

.
.
.

After=home.mount

.
.
.

Riferimenti

Powered by Soopr   •  Theme  Moonwalk