So I had to deploy in Rocky Linux 8 memcached with SOCKET in /var/run/memcached
In order to avoid the service to fail, I have run the following:
- systemctl edit memcached.service
Pasted in:
[Unit]
Description=Memcached
Before=httpd.service
After=network.target
[Service]
Type=simple
User=memcached
Group=memcached
# Run ExecStartPre with root-permissions
ExecStartPre=-/usr/bin/mkdir /var/run/memcached
ExecStartPre=-/usr/bin/chown -R memcached:memcached /var/run/memcached/
[Install]
WantedBy=multi-user.target
[root@cp monit.d]# service memcached status
Redirecting to /bin/systemctl status memcached.service
● memcached.service - Memcached
Loaded: loaded (/usr/lib/systemd/system/memcached.service; enabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/memcached.service.d
└─override.conf
Active: active (running) since Thu 2022-10-13 15:23:50 CEST; 3s ago
Process: 1336192 ExecStartPre=/usr/bin/chown -R memcached:memcached /var/run/memcached/ (code=exited, status=0/SUCCESS)
Process: 1336188 ExecStartPre=/usr/bin/mkdir /var/run/memcached (code=exited, status=1/FAILURE)
Main PID: 1336194 (memcached)
Tasks: 10 (limit: 101049)
Memory: 3.6M
CGroup: /system.slice/memcached.service
└─1336194 /usr/bin/memcached -p 11211 -u memcached -m 256 -c 1024 -s /var/run/memcached/memcached.sock -a 0770
Oct 13 15:23:50 cp.uhlhosting.ch systemd[1]: Starting Memcached...
Oct 13 15:23:50 cp.uhlhosting.ch systemd[1]: Started Memcached.
What would be a way to avoid this FAILURE?
ExecStartPre=/usr/bin/mkdir /var/run/memcached (code=exited, status=1/FAILURE)
Thank you!