T
T
Templar3d2022-04-08 14:30:28
linux
Templar3d, 2022-04-08 14:30:28

How to add a program running in the background to startup?

You need to reread the squid config every second or faster.
Made a service like this, did systemctl daemon-reload && systemctl start my.service and but it doesn't work:

Process: 25961 ExecStart=/usr/bin/watch -n 1 squid -k reconfigure (code=exited, status=1/FAILURE)
Main PID: 25961 (code=exited, status=1/FAILURE)
systemd[1]: Started reread proxy config every 1 seconds.
watch[25961]: Error opening terminal: unknown.
systemd[1]: мой.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: мой.service: Failed with result 'exit-code'.


my.service:
[Unit]
Description=reread proxy config every 1 seconds
After=syslog.target
After=nginx.service

[Service]
#User=root
ExecStart=/usr/bin/watch -n 1 squid -k reconfigure
#Type=forking
#Restart=always

[Install]
WantedBy=multi-user.target


Maybe someone knows why?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
ky0, 2022-04-08
@ky0

Need to reread squid config every second or faster

You are clearly doing something wrong.

N
nsnoob, 2022-04-08
@nsnoob

do you need a daemon for that? go to crontab

V
Vitaly Karasik, 2022-04-08
@vitaly_il1

As already said, most likely you can avoid the need to do a reload every second.
But if you still want to do this, then you need to use systemd timer, not service: https://opensource.com/article/20/7/systemd-timers

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question