iscsi-scst: use /run instead of /var/run

When attempting to manage iscsi-scstd using a systemd service file,
systemd warns:

PIDFile= references a path below legacy directory /var/run/, [...]

Change the pidfile path to be under /run instead.

/run has been in use as a replacement for /var/run for many years now
(the original Debian proposal is from 2011). Most distributions symlink
/var/run to /run, which means that this change should not have any
adverse side effects for the vast majority of users.
This commit is contained in:
Christoph Böhmwalder
2025-06-26 12:56:31 +02:00
committed by Gleb Chesnokov
parent 17eb80e049
commit 3aad61d2fd
2 changed files with 4 additions and 4 deletions

View File

@@ -979,7 +979,7 @@ int main(int argc, char **argv)
pid_t pid;
int fd;
fd = open("/var/run/iscsi-scstd.pid", O_WRONLY|O_CREAT, 0644);
fd = open("/run/iscsi-scstd.pid", O_WRONLY|O_CREAT, 0644);
if (fd < 0) {
log_error("unable to create pid file");
exit(1);

View File

@@ -102,7 +102,7 @@ start_daemon() {
killproc() {
exe=$(basename "$1")
killall "$exe"
rm -f "/var/run/$exe.pid"
rm -f "/run/$exe.pid"
}
fi
@@ -275,8 +275,8 @@ stop_scst() {
scst_status() {
# Status has a slightly different meaning for the status command:
# 0 - service running
# 1 - service dead, but /var/run/ pid file exists
# 2 - service dead, but /var/lock/ lock file exists
# 1 - service dead, but /run/ pid file exists
# 2 - service dead, but /run/lock/ lock file exists
# 3 - service not running
parse_scst_conf