Select Your Language

Infrastructure and Management

Cloud Computing

Storage

Runtimes

Integration and Automation

  • Comments
  • Help needed creating a custom unit file (service) for swatch

    Posted on

    I've installed swatch and it works fine when run from the command line, next step was to create a custom unit file for it, I have done this (see below) and when I run systemctl start swatch.service it works great, however, if I reboot the server it fails to start, and then if I start it manually I get this error

    [/etc/systemd/system/swatch.service:8] Executable path is not absolute, ignoring: kill -s KI...tch.pid)
    Hint: Some lines were ellipsized, use -l to show in full.
    

    Here is the custom unit file

    [Unit]
    Description=Swatch Log Monitoring Daemon
    After=syslog.target network.target auditd.service sshd.service
    
    [Service]
    ExecStart=/usr/bin/swatch --config-file=/etc/swatch/yum.conf --tail-file=/var/log/yum.log --pid-file=/var/run/swatch.pid --daemon
    ExecStop=kill -s KILL $(cat /var/run/swatch.pid)
    Type=forking
    PIDFile=/var/run/swatch.pid
    
    [Install]
    WantedBy=multi-user.target
    

    swatch is in /bin/swatch and /usr/bin/swatch - I've tried both and I get the same result.

    There is a /root/.swatch_script.xxxx file create when running it from the command line, is this causing an issue?

    by

    points

    Responses

    Red Hat LinkedIn YouTube Facebook X, formerly Twitter

    Quick Links

    Help

    Site Info

    Related Sites

    © 2026 Red Hat