[Unit] Description=P4 Log Feeder - feeds Perforce server log chunks to LogChunksDir After=network.target # If p4d is managed by systemd on this host, uncomment to add ordering: # After=p4d_1.service [Service] Type=simple User=perforce Group=perforce # SDP environment: P4LOG and LOGS are set per instance by sourcing # /p4/common/bin/p4_vars . That file is a real shell script (uses # command substitution, conditionals, etc.), NOT a simple KEY=VALUE file, so # it cannot be loaded via systemd's EnvironmentFile= directive (systemd will # silently ignore every non-trivial line, leaving P4LOG/LOGS unset). Instead, # source it in a shell wrapper before exec'ing the binary. # Adjust the instance number below as needed: Environment=INSTANCE=1 ExecStart=/bin/bash -c 'source /p4/common/bin/p4_vars ${INSTANCE} && exec /p4/common/site/log_feeder/p4lf -config /p4/common/site/log_feeder/p4lf.cfg' # On SIGHUP: reload config and rotate p4lf's own log. ExecReload=/bin/kill -HUP $MAINPID Restart=on-failure RestartSec=10s # Ensure clean shutdown: SIGTERM first, then SIGKILL after 30s. TimeoutStopSec=30 KillMode=mixed KillSignal=SIGTERM # Limit resource usage. LimitNOFILE=65536 StandardOutput=null StandardError=journal [Install] WantedBy=multi-user.target