Update service user
This commit is contained in:
parent
4e642ca4fd
commit
bce19458ee
|
@ -8,6 +8,7 @@ WorkingDirectory=$workingDirectory
|
|||
ExecStart=$execStart
|
||||
Restart=on-failure
|
||||
SyslogIdentifier=chutney
|
||||
User=$user
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
5
install
5
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:
|
||||
|
|
Loading…
Reference in New Issue