From bce19458ee1ea51e06a1047646436efcd921cb19 Mon Sep 17 00:00:00 2001 From: Mike Cifelli <1836280-mike-cifelli@users.noreply.gitlab.com> Date: Fri, 23 Dec 2022 12:37:27 -0500 Subject: [PATCH] Update service user --- chutney.service | 1 + install | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/chutney.service b/chutney.service index dd6d6ae..b854982 100644 --- a/chutney.service +++ b/chutney.service @@ -8,6 +8,7 @@ WorkingDirectory=$workingDirectory ExecStart=$execStart Restart=on-failure SyslogIdentifier=chutney +User=$user [Install] WantedBy=multi-user.target diff --git a/install b/install index cb9995a..14ecce7 100755 --- a/install +++ b/install @@ -5,6 +5,7 @@ import sys from string import Template from subprocess import check_call +from subprocess import check_output EXEC = 'chutney.py' SERVICE = 'chutney.service' @@ -15,13 +16,15 @@ SERVICE_TEMPLATE = os.path.join(CURRENT_DIR, SERVICE) SERVICE_FILE = os.path.join(SYSTEM_DIR, SERVICE) PYTHON = sys.executable EXEC_START = f'{PYTHON} {EXEC}' +USER = check_output(['logname']).decode('utf-8').strip() with open(SERVICE_TEMPLATE) as f: serviceTemplate = Template(f.read()) serviceFile = serviceTemplate.substitute( workingDirectory=CURRENT_DIR, - execStart=EXEC_START + execStart=EXEC_START, + user=USER ) with open(SERVICE_FILE, 'w') as f: