0
Good morning, I was looking at the systemd doc on the output part https://www.freedesktop.org/software/systemd/man/systemd.exec.html#Logging%20and%20Standard%20Input/Output
"The file:path option may be used to connect a specific file system Object to standard input. An Absolute path following the ":" Character is expected, which may refer to a regular file, a FIFO or special file. If an AF_UNIX socket in the file system is specified, a stream socket is Connected to it. The Latter is Useful for Connecting standard input of processes to arbitrary system services."
I noticed that there is the option to use a UNIX_SOCKET as output, however, when trying to set it in . service, the service start fails
I used the following process to create a UNIX_SOCKET python -c "import socket as s; Sock = s.socket(s. AF_UNIX); Sock.bind('/tmp/test.Sock')"
mar 09 08:44:28 mypc systemd[1]: teste.service: Service RestartSec=100ms expired, scheduling restart.
mar 09 08:44:28 mypc systemd[1]: teste.service: Scheduled restart job, restart counter is at 5.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Automatic restarting of the unit teste.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
mar 09 08:44:28 mypc systemd[1]: Stopped test.
-- Subject: A unidade teste.service concluiu o desligamento
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A unidade teste.service concluiu o desligamento.
mar 09 08:44:28 mypc systemd[1]: teste.service: Start request repeated too quickly.
mar 09 08:44:28 mypc systemd[1]: teste.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- The unit teste.service has entered the 'failed' state with result 'exit-code'.
mar 09 08:44:28 mypc systemd[1]: Failed to start test.
-- Subject: A unidade teste.service falhou
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A unidade teste.service falhou.
Copy of the . service
#/usr/lib/systemd/system
[Unit]
Description=test
After=network.target
[Service]
PIDFile=/run/test.pid
ExecStart=/bin/test
ExecReload=/bin/kill -HUP $MAINPID
Timeoutsec=300
Restart=always
SyslogIdentifier=test
StandardOutput=append:/tmp/test.sock
[Journal]
Storage=persistent
[Install]
WantedBy=multi-user.target
I also noticed that when removing the socket created, so that systemd then create the file, it creates a common file and does the logging process normally, so I believe the service itself is OK, the problem only occurs when the final log file is the Unix socket. Then I would like some guidance on how to proceed so that this service starts logging into a unix_socket file instead of a common file