B
B
bsbak2019-03-14 13:10:09
linux
bsbak, 2019-03-14 13:10:09

How to change PATH in debian .service?

Prepared website.service service:

[Unit]
Description=web site
After=network.target

[Service]
User=mf
Group=sudo
Type=simple
Restart=on-abort
RestartSec=5s
WorkingDirectory=/home/website
Environment=PATH=/home/mf/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ExecStartPre=/bin/sh -c "systemctl set-environment PATH=/home/mf/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
ExecStart=/bin/bash -c 'PATH=/home/mf/node_modules/.bin:$PATH exec sudo ./website'

[Install]
WantedBy=multi-user.target

Immediately in 3 lines I try to change PATH and still the result does not change! I check with the help of .website in which there is a line - at startup it displays PATH
fmt.Println(os.Getenv("PATH")) // /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

Also changed the /etc/environment file
PATH="/home/mf/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

And it didn't help either.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question