Run systemctl in container [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
I want to set up some stuff when starting Kubernetes node worker. Specifically, I change systemd service configuration and apply it (systemctl daemon-reload), but from inside the container, I don't know how to configure systemd of node worker

Not sure what you actually want to do, but
Usually systemd is not installed inside containers
I don't know what you want to implement, but I pretty sure that run systemd daemon inside container is a bad idea
In most cases if you want to start long running background process, that will be better idea to run it in separate container and connect two containers.
If you need to do some action on container start before run main process, just override entrypoint, and prepend own command before main one (you may add it with & symbol to run in background, but it is a not smart solution)

Related

Cyclic docker container restart (linux server) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
So i want to cyclically restart my docker container (once a week - let's say Sunday, 22:00)
Does anyone know how to call docker restart ID every Sunday?
You could set up a restart policy with the docker run command, and use the -d parameter which Docker recommends,
More information in the docker documentation,
https://docs.docker.com/config/containers/start-containers-automatically/
Update:
Create a cron job to restart the docker container on Sunday at 22:00.
The Docker restart policy should start the container again.
Create an anacron job inside the container, to launch your program after the Docker container starts again.

Local Linux user that automatically executes a command thyat can't be turned off [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I've spent last few hours looking for a solution for my problem which is:
I have my home server set up next to me with a small monitor attached to it. What i want to do is i want to create an additional user called "monitor" that executes command "nethogs eth1" straight after it has been logged one locally on the machine, and does not allow to turn off the script.
Basically i want nethogs running 24/7 on my monitor, without way to turn it off.
Please help me if you know the solution.
sudo adduser monitor
echo "sudo -u monitor nethogs eth1" >> /etc/rc.local
Each time your machine boots, it will execute nethogs eth1 as user monitor, and only root or monitor itself can stop that command.

Change linux user default ownership on file creation? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
Seems like something which should be easy to find but Googling brings up lots of unrelated tasks.
I have a deploy scipt which runs under the user "deploy" but my web server runs as "nginx" I want the web server to be able to write to the deployed files.
Ive added nginx to the deploy user group and I believe I can write files with deploy user with the ownership "nginx:deploy" easily now but by default it creates files as "deploy:deploy" obviously which nginx won't write too.
Is there anyway to change the user so that by default creates files as "nginx:deploy" to solve this problem?
The install command has options to control the owner and group of the files it creates. But in general, only root can create files as a different user. Maybe you can configure sudoers to let the deploy user run the commands it needs with sudo as the nginx user.

Automatic restart of a crashing Linux daemon [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I have a Linux server application that I managed to "deploy" as a daemon that can be started automatically when the machine starts, independently of user sessions..
I wonder if it is possible to tell the system to automatically restart the application when it crashes, like the service manager in Windows..
Thank you in advance.
Give it a look to monit, it monitors any service/daemon. You have to configure Monit in order to know what criteria to use to start/stop or email you in case something wrong/strange is going on.
What you need is a process supervisor, a utility that manages your daemon and decides when to start/stop it among other things.
There are several of these out there such as supervisord, upstart, runit etc. You will have to research them and find one that best suits your needs.
Hope that helps.

Why use the service command in linux? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
What is the difference between
service apache2 restart
and
/etc/init.d/apache2 restart
So basically why is the service command recommended compared to directly invoking the appropriate command?
The service command runs the init scripts in a predictable environment:
service runs a System V init script in as predictable environment as possible, removing most environment variables and with current working directory set to /.
from: http://linux.die.net/man/8/service

Resources