Skip to content
Snippets Groups Projects
Select Git revision
  • a500e7ce47e1254c8245891c441c23df703b59e2
  • master default protected
  • extended_maintenance
3 results

error-summary.service.j2

Blame
  • error-summary.service.j2 1.11 KiB
    [Unit]
    Description=service daily Rosetta error summary
    
    [Service]
    Type=oneshot
    Restart=no
    ExecStart=/bin/bash -c '/operational_shared/software/error-summary.sh | /usr/bin/mail -s "Rosetta Error Summary from %H" "langzeitarchiv@slub-dresden.de"'
    User={{ vault_rosetta_user }}
    Group={{ vault_rosetta_group }}
    
    # https://unix.stackexchange.com/a/231201 says:
    # /usr/bin/mail performs a double fork to daemonize sendmail for sending the email. This sendmail proc gets reowned to init, so normally it wouldn't be affected by anything that happens with the original parent - except in the systemd case that reowned grandchild is still in the same cgroup as the original service. When systemd tears things down, it kills all processes within the cgroup, including the reowned sendmail process.
    # The mail command itself ran fine, but sendmail was getting killed by systemd before it had a chance to do its thing.
    # You can get around this by setting KillMode in the Unit section to process (the default is control-group). That will cause systemd to only kill the process which it directly fired.
    KillMode=process
    
    [Install]
    WantedBy=default.target