N
N
nexcode2016-01-22 10:55:15
linux
nexcode, 2016-01-22 10:55:15

systemd service | How to update a daemon file without having to stop the process?

For example, there is such a service file:

[Unit]
Description=App name
After=syslog.target

[Service]
WorkingDirectory=/home/user/app
ExecStart=/home/user/app/app
Restart=always
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=app-name
User=user
Group=user
LimitNOFILE=infinity

[Install]
WantedBy=multi-user.target

Executable file: /home/user/app/app
Now the system will not allow the file to be overwritten while the process is running.
You need to do systemctl stop , systemctl start .
Is it possible to make a configuration that allows you to replace the executable and then do systemctl restart ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mithraen, 2016-01-28
@nexcode

On Linux, if a file cannot be written to, it can usually be renamed and even deleted. And write anything in its place.
Write your updated app as /home/user/app/app.new and run the commands:

mv /home/user/app/app /home/user/app/app.old
mv /home/user/app/app.new /home/user/app/app

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question