journalctl – remove logs of a specific unit
After some research I found that you can’t delete logs for a specific systemd unit, because the logs are interlaced and if you delete only one unit you’ll corrupt the logs, so journalctl doesn’t let you.
After some research I found that you can’t delete logs for a specific systemd unit, because the logs are interlaced and if you delete only one unit you’ll corrupt the logs, so journalctl doesn’t let you.
The reason, it does not complete the startup sequence is, that for Type forking your startup process is expected to fork and exit (see $ man systemd.service – search for forking). Simply use only the main process, do not daemonize One option is to do less. With systemd, there is often no need to create … Read more
I think I found the answer: In the .service file, I needed to add /bin/bash before the path to the script. For example, for backup.service: ExecStart=/bin/bash /home/user/.scripts/backup.sh As opposed to: ExecStart=/home/user/.scripts/backup.sh I’m not sure why. Perhaps fish. On the other hand, I have another script running for my email, and the service file seems to … Read more
This is by design. Docker should be running a process in the foreground in your container and it will be spawned as PID 1 within the container’s pid namespace. Docker is designed for process isolation, not for OS virtualization, so there are no other OS processes and daemons running inside the container (like systemd, cron, … Read more
if Type=simple in your unit file, you can only specify one ExecStart, but you can add as many ExecStartPre, ExecStartPost, but none of this is suited for long running commands, because they are executed serially and everything one start is killed before starting the next one. If Type=oneshot you can specify multiple ExecStart, they run … Read more
By default, a SIGTERM is sent, followed by 90 seconds of waiting followed by a SIGKILL. Killing processes with systemd is very customizable and well-documented. I recommend reading all of man systemd.kill as well as reading about ExecStop= in man systemd.service. To respond to those signals, refer to the signal handling documentation for the language … Read more
For systemd version >= 229, there is an option called RuntimeMaxSec, which terminates the service after it has been running for the given period of time. e.g. To restart every 7 days: [Service] Restart=always RuntimeMaxSec=7d To me this seems more elegant than abusing Type=notify and WatchdogSec. systemd provides a clean way to add and override … Read more
You can run the sleep command before your ExecStart with ExecStartPre : [Service] ExecStartPre=/bin/sleep 30
In the .service file under the [Unit] section: [Unit] Description=My Website After=syslog.target network.target mongodb.service The important part is the mongodb.service The manpage describes it however due to formatting it’s not as clear on first sight systemd.unit – well formatted systemd.unit – not so well formatted
Try to run the following two commands: sudo fuser -k 80/tcp sudo fuser -k 443/tcp Then execute sudo service nginx restart If that worked, your hosting provider might be installing Apache on your server by default during a fresh install, so keep reading for a more permenant fix. If that didn’t work, keep reading to … Read more