Skip to content

Commit 8fa4e15

Browse files
committed
Better PID file location
1 parent 5e626e7 commit 8fa4e15

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

common/utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,11 @@ def pid_file_name(node_type: str, node_name: str) -> str:
4848
"""
4949
The name of the file that is used to store the process ID.
5050
"""
51-
# TODO: Use a better choice for the temp directory than /tmp
52-
return f"/tmp/dske-{node_type}-{node_name}.pid"
51+
file_name = f"dske-{node_type}-{node_name}.pid"
52+
dir_name = "/var/run"
53+
if os.path.exists(dir_name) and os.access(dir_name, os.W_OK):
54+
return f"{dir_name}/{file_name}"
55+
return file_name
5356

5457

5558
def create_pid_file(node_type: str, node_name: str) -> None:

0 commit comments

Comments
 (0)