A következő címkéjű bejegyzések mutatása: systemd. Összes bejegyzés megjelenítése
A következő címkéjű bejegyzések mutatása: systemd. Összes bejegyzés megjelenítése

2019. április 1., hétfő

Systemd services command cheatsheet

List of all services and their status:
service --status-all
Another way:
systemctl list-units --type service --all  
 
List just the enabled services 
systemctl list-units --type service   
or systemctl -l –type service –all
 
Stop/Start/Restart a service 
systemctl restart/start yourservicename
 
Enable/Disable the startup of a service at boot time
systemctl enable/disable yourservicename 
 
Is it enabled? 
systemctl is-enabled yourservicename
 
Uninstall/wipe a service 
rm /etc/systemd/system/yourservicename
systemctl daemon-reload
systemctl reset-failed
 
Find out the dependencies: 
systemctl list-dependencies --type service
 
Get the files related to the service:
locate yourservicename.service 

Disable the service and forbids the others from start it
systemctl mask yourservicename

list systemd unit files and their states (enabled/disabled/etc)
systemctl list-unit-files 

To see / set the default runlevel of the system
systemctl get-defaults (set-defaults)
e.g. multi-user.target or graphical.target

systemctl isolate 
explained: (stolen from internet)
The word "isolate" means run the requested unit, and make sure nothing else is running (with a few exceptions.) Since runlevels have been replaced by targets (which are more or less just a set of services that you want to be running in a certain situation, like for multi-user or graphical usage), you can switch to a "runlevel" by starting the equivalent target and stopping anything that is not part of the new target - using isolate.
systemctl isolate multi-user.target is the modern way to unload the graphic shell, which was done by init 3 previously.   You are in runlevel 5 or to be precise in graphical.target. You do runlevel 3 or systemctl isolate multiuser.target.

Another way to change target runlevel.
systemctl set-default multi-user.target (then reboot)

 

2018. március 26., hétfő

Systemd over NTP

Ever wondered how to setup an NTP client controlled by systemd? Here are some short steps.
Symptom:

Mar 26 19:24:43 lokalhost systemd-timesyncd[403]: Timed out waiting for reply from 118.189.177.157:123 (0.debian.pool.ntp.org).
Mar 26 19:24:54 lokalhost systemd-timesyncd[403]: Timed out waiting for reply from 103.47.76.177:123 (0.debian.pool.ntp.org).
Mar 26 19:25:04 lokalhost systemd-timesyncd[403]: Timed out waiting for reply from 128.199.123.83:123 (0.debian.pool.ntp.org).
Mar 26 19:25:14 lokalhost systemd-timesyncd[403]: Timed out waiting for reply from 139.59.219.101:123 (0.debian.pool.ntp.org).
Mar 26 19:25:24 lokalhost systemd-timesyncd[403]: Timed out waiting for reply from 202.156.0.34:123 (1.debian.pool.ntp.org).
Mar 26 19:25:35 lokalhost systemd-timesyncd[403]: Timed out waiting for reply from 128.199.87.57:123 (1.debian.pool.ntp.org).
Mar 26 19:25:45 lokalhost systemd-timesyncd[403]: Timed out waiting for reply from 128.199.169.185:123 (1.debian.pool.ntp.org).
Mar 26 19:25:55 lokalhost systemd-timesyncd[403]: Timed out waiting for reply from 103.23.208.175:123 (1.debian.pool.ntp.org).
Mar 26 19:26:05 lokalhost systemd-timesyncd[403]: Timed out waiting for reply from 172.104.55.191:123 (2.debian.pool.ntp.org).


Solution:
1. nano /etc/systemd/timesyncd.conf
2. Set your NTP server, e.g.: NTP=172.16.36.67
3. systemctl restart systemd-timesyncd.service 
4. timedatectl set-ntp true
5. Check with: timedatectl status