Objective: Run commands in the foreground and background, find any process by its PID, and stop it with a signal. Read how systemd starts and watches your services, switch to the rescue target, and restart the server. Then check the clock, change the time zone, and see how chrony and NTP keep the time right.
Every command you have run in this course became a process while it ran. Some, like ls, finish in a moment. Others, like sshd, Nginx and firewalld, run until the server shuts down. In Lab 7 you already stopped an ssh-agent process with kill and pkill, and in Labs 13 and 14 you used systemctl to start, enable and reload services. This lab explains what was happening underneath.
The last part of the lab is about time. Your server sets its clock with NTP (Network Time Protocol), which you switched on in the installer in Lab 1. A wrong clock breaks more than you might expect, including the HTTPS you set up in Lab 17.
Note: This lab is done on your development server, NOT your production server. Connect with SSH from Terminal or PuTTY and log in as your own user. Part 4 also needs the UTM or VirtualBox console.
Warning: Part 4 switches the server to rescue mode and restarts it, which ends every SSH session. Never run those commands on your production server. It has no console, so you might not get back in.
Some steps give you every command. Others give you a Goal and ask you to work out the commands yourself. If you get stuck, open the hint. Once you have an answer, or if you are really stuck, open the solution and compare it with your own.
If you get stuck, check the Troubleshooting section at the end of this lab.
The examples in this lab use the username angus. Your PIDs, times and addresses will be different.
When you type a command, it runs in the foreground: the shell waits for it to finish before it gives you a new prompt. Add & to the end of a command and it runs in the background instead, so you get your prompt back straight away. A command you start from your shell, in either place, is called a job.
First check for jobs. You haven't started any, so this prints nothing:
jobs
The next command is a small loop. You learn loops properly in Lab 22. For now, read it as: while true (forever), write a line to /tmp/hello.log, then wait 5 seconds. The & at the end sends the whole loop to the background.
while true; do echo "hello $USER, today is $(date)" >> /tmp/hello.log; sleep 5; done &
[1] 4721
| Part | What it does |
|---|---|
while true; do ... done |
Repeats the commands between do and done until something stops it. true never fails, so it never stops by itself. |
$(date) |
The command substitution from Lab 7: the output of date goes into the line. |
>> /tmp/hello.log |
Appends to the file, as in Lab 5. |
sleep 5 |
Waits 5 seconds. |
& |
Runs the loop in the background. |
[1] 4721 |
The shell's reply: job number 1, and the process ID (PID) of the background process. |
Check that the file is growing. Run the command twice, a few seconds apart:
cat /tmp/hello.log
Question: How often is a line added to
hello.log?
Every 5 seconds, because of sleep 5. The time in each line goes up by 5 seconds.
Start a second loop. This one writes the value of $SSH_CONNECTION every 3 seconds. You used that variable in Lab 12: it holds your laptop's address and port, and the server's address and port.
while true; do echo "ssh connections: $SSH_CONNECTION" >> /tmp/ssh_connections.log; sleep 3; done &
Watch the new file as it grows. tail -f (follow) keeps printing new lines until you press Ctrl+C:
tail -f /tmp/ssh_connections.log
After a few lines, press Ctrl+C. That stops tail, the job in the foreground. The two loops in the background keep running.
Question: If you had logged in on the console instead of with SSH, what would the loop write?
Only ssh connections: with nothing after it. $SSH_CONNECTION is set by sshd when you log in with SSH. A console login doesn't set it, so it is empty.
jobs
[1]- Running while true; do
echo "hello $USER, today is $(date)" >> /tmp/hello.log; sleep 5;
done &
[2]+ Running while true; do
echo "ssh connections: $SSH_CONNECTION" >> /tmp/ssh_connections.log; sleep 3;
done &
The + marks the current job, the one fg uses if you don't give a number. The - marks the one before it. Bring job 1 to the foreground with fg %1. Your prompt doesn't come back, because the loop now has the terminal. Press Ctrl+C to stop it, then check again:
fg %1
Press Ctrl+C, then:
jobs
Only job 2 is left.

Goal: Stop job 2 while it stays in the background, without fg. Then show that no jobs are left.
kill in Lab 7 to stop ssh-agent by its PID.kill also accepts a job number, written the same way you wrote it for fg.kill %2
jobs
[2]+ Terminated while true; do
echo "ssh connections: $SSH_CONNECTION" >> /tmp/ssh_connections.log; sleep 3;
done
jobs reports Terminated once, then nothing the next time you run it. %2 only means something to your own shell. Another shell, or another user, has its own job numbers.
Another way: fg with no number brings back the current job (+). Then press Ctrl+C.
If you start a long command without &, you don't have to wait for it. Ctrl+Z pauses (stops) the job in the foreground, and bg lets it carry on in the background:
sleep 300
Press Ctrl+Z:
^Z
[1]+ Stopped sleep 300
bg
jobs
fg
Press Ctrl+C to end sleep.
| Key or command | What it does |
|---|---|
command & |
Starts the command in the background. |
jobs |
Lists the jobs started from this shell. |
fg %N |
Brings job N to the foreground. |
| Ctrl+C | Stops (ends) the job in the foreground. |
| Ctrl+Z | Pauses the job in the foreground. jobs shows it as Stopped. |
bg %N |
Lets a paused job carry on in the background. |
kill %N |
Ends job N. |
Tip: A paused job does nothing until you run
bgorfg. If you try to log out with a paused job, the shell warns There are stopped jobs. Runjobsto see it.
Jobs belong to one shell. Processes are everything running on the server, started by anyone. Each one has a PID (process ID) and a PPID (parent process ID): the PID of the process that started it.
Your shell is a process too. $$ holds its PID:
echo $$
ps
ps -f
2973
PID TTY TIME CMD
2973 pts/0 00:00:00 bash
4790 pts/0 00:00:00 ps
On its own, ps only lists processes in your current terminal. Options show more:
| Command | What it shows |
|---|---|
ps -f |
Full format: adds the user (UID), PPID and start time. |
ps -e |
Every process on the server. |
ps -ef |
Every process, full format. The most common form. |
ps -u $USER |
Only your processes. |
ps -fj |
Full format plus job columns (process group and session). |
ps -ejH |
Every process, indented to show which started which (Hierarchy). |
ps -eLf |
Every thread (a process can do several things at once with threads). |
Try them. The long lists are easier to read in less, which you used in Lab 2:
ps -ef | less
ps -ejH | less
Question: In
ps -ef, what is process 1, and who runs it?
/usr/lib/systemd/systemd, run by root. The kernel starts it first, and it starts everything else. You look at it in Part 3.
You don't have to read the whole list. pgrep and pidof find processes by name:
pgrep sshd
pidof sshd
You usually get more than one PID. One sshd listens for new connections, and each SSH session has its own sshd processes.
top shows the busiest processes, updated every few seconds:
top
| Key in top | What it does |
|---|---|
P |
Sort by CPU use (the default). |
M |
Sort by memory use. |
u |
Show one user's processes. Type the name, then Enter. |
h |
Help. |
q |
Quit. |
top -u $USER starts with only your processes.
Start the second loop again, and look at it with ps -fj:
while true; do echo "ssh connections: $SSH_CONNECTION" >> /tmp/ssh_connections.log; sleep 5; done &
echo $$
ps -fj
[1] 4735
2973
UID PID PPID PGID SID C STIME TTY TIME CMD
angus 2973 2972 2973 2973 0 16:02 pts/0 00:00:00 -bash
angus 4735 2973 4735 2973 0 21:07 pts/0 00:00:00 -bash
angus 4739 4735 4735 2973 0 21:07 pts/0 00:00:00 sleep 5
angus 4740 2973 4740 2973 0 21:07 pts/0 00:00:00 ps -fj
| PID | PPID | What it is |
|---|---|---|
2973 |
2972 |
Your login shell ($$). Its parent is your SSH session's sshd. |
4735 |
2973 |
A copy of the shell that runs the loop. & started it, so its parent is your shell, and its PID is the one in [1] 4735. |
4739 |
4735 |
The sleep the loop is waiting on. Its parent is the loop. |
4740 |
2973 |
ps itself. |
To stop the loop, kill the copy of the shell, not sleep. Use your PID:
kill 4735
jobs

Question: What would happen if you killed the
sleepprocess instead?
The loop carries on. When sleep ends, early or not, the loop writes its next line and starts a new sleep. Killing the child doesn't stop the parent.
kill doesn't really kill. It sends a signal, a short message, and the process decides what to do with most of them. List them with kill -l. These are the ones you meet most:
| Signal | Number | Sent by | What it usually does |
|---|---|---|---|
TERM |
15 | kill PID (the default) |
Asks the process to clean up and end. |
INT |
2 | Ctrl+C | Interrupts the job in the foreground. |
TSTP |
20 | Ctrl+Z | Pauses the job in the foreground. |
HUP |
1 | kill -HUP PID, or closing the terminal |
Ends most programs. Many services treat it as "reload your config". |
KILL |
9 | kill -9 PID |
Ends the process at once. It can't be caught or ignored. |
Common Pitfall: Don't reach for
kill -9first. The process gets no chance to save its work or remove its files. Try plainkill, wait a few seconds, and only use-9if it is still there.
Goal: Your web server from Lab 13 is still running. Find all of its processes. Which one is the main process, which user runs each one, and how are they related? What is the PPID of the main process?
ps -ef and grep, as in Lab 3. Your own grep shows up in the list too.PID and PPID columns.ss -tlnp showed a main process and one worker per CPU. Then you wrote a new nginx.conf. How many workers does it ask for?ps -ef | grep nginx
root 921 1 0 09:12 ? 00:00:00 nginx: master process /usr/sbin/nginx
nginx 922 921 0 09:12 ? 00:00:00 nginx: worker process
angus 4810 2973 0 21:15 pts/0 00:00:00 grep --color=auto nginx
| Process | User | PPID | Why |
|---|---|---|---|
| master process | root | 1 |
Started by systemd (PID 1). It needs root to open port 80, and reads the config. |
| worker process | nginx | 921 |
Started by the master. It answers the requests, as the less powerful nginx user. |
There is one worker because your Lab 13 config has worker_processes 1;. The ? under TTY means no terminal: services aren't started from anyone's shell.
Another way: pgrep -a nginx prints PIDs with their command lines and leaves out your grep. ps -ejH | less and a search for nginx shows the worker indented under the master.
Clean up the log files from Parts 1 and 2:
jobs
rm /tmp/hello.log /tmp/ssh_connections.log
If jobs still lists a loop, stop it with kill %N first, or the file comes back.
systemd is PID 1. It starts the services when the server boots, restarts some of them if they fail, and stops them at shutdown. Everything systemd manages is a unit. List the unit types:
systemctl -t help
You use two types in this lab: service (a program such as nginx.service) and target (a group of units, Part 4).
systemctl list-units --type=service
systemctl list-unit-files --type=service
| Command | What it shows |
|---|---|
list-units |
Units systemd has loaded now, and whether each is running (active running), finished (active exited) or broken (failed). |
list-unit-files |
Every unit file installed, running or not, and whether it starts at boot (enabled, disabled, or static: only started when another unit needs it). |
Both lists are long. Narrow them with grep, for example systemctl list-unit-files --type=service | grep "nginx\|sshd\|chronyd".
You have run systemctl status since Lab 7. Look at it again with what you know about processes:
systemctl status nginx
● nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; preset: disabled)
Active: active (running) since Thu 2026-11-12 09:12:40 PST; 12h ago
Process: 918 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
Process: 919 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
Process: 920 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
Main PID: 921 (nginx)
Tasks: 2 (limit: 10890)
Memory: 2.4M
CPU: 41ms
CGroup: /system.slice/nginx.service
├─921 "nginx: master process /usr/sbin/nginx"
└─922 "nginx: worker process"
| Line | What it tells you |
|---|---|
Loaded |
Where the unit file is, and that it is enabled (starts at boot). preset is what the package would choose; you changed it. |
Active |
Running now, and for how long. |
Process |
Commands systemd ran while starting it. They finished, so they have exited. |
Main PID |
The master process you found in Task 2. |
CGroup |
Every process that belongs to the service. systemd tracks them all, so systemctl stop doesn't miss a worker. |
The unit file tells systemd how to run the service. systemctl cat prints it:
systemctl cat nginx
# /usr/lib/systemd/system/nginx.service
[Unit]
Description=The nginx HTTP and reverse proxy server
After=network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
[Service]
Type=forking
PIDFile=/run/nginx.pid
ExecStartPre=/usr/bin/rm -f /run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t
ExecStart=/usr/sbin/nginx
ExecReload=/usr/sbin/nginx -s reload
KillSignal=SIGQUIT
TimeoutStopSec=5
KillMode=mixed
PrivateTmp=true
[Install]
WantedBy=multi-user.target
| Section or line | What it means |
|---|---|
[Unit] |
What the unit is, and what it starts after: here, once the network is up. |
ExecStartPre |
Runs before the start. nginx -t is the test you ran in Lab 13, so a broken config stops Nginx from starting at all. |
ExecStart |
The command that starts the service. |
ExecReload |
What systemctl reload nginx runs. You used it in Lab 13. |
KillSignal |
The signal systemctl stop sends (Part 2). |
[Install] WantedBy |
Read by systemctl enable. It creates a link in multi-user.target.wants/, so the multi-user target starts Nginx at boot. |
That last line answers Lab 14, Task 1: the link enable made for firewalld is in multi-user.target.wants/ because firewalld's unit file says WantedBy=multi-user.target.
Note: Don't edit files in
/usr/lib/systemd/system/. They belong to the package, and an update replaces them. Your own changes go in/etc/systemd/system/, whichsystemctl editcreates for you. You don't need that in this lab.
Goal: Read the unit file for sshd. Find out what systemctl reload sshd does, whether systemd starts sshd again by itself if it crashes, and which target starts it at boot.
ExecReload, Restart and WantedBy.$MAINPID is the Main PID from systemctl status.systemctl cat sshd
[Service]
...
ExecStart=/usr/sbin/sshd -D $OPTIONS
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartSec=42s
[Install]
WantedBy=multi-user.target
| Line | Answer |
|---|---|
ExecReload |
reload sends the HUP signal from Part 2 to the main sshd. sshd reads its config again. |
Restart=on-failure |
Yes. If sshd ends with an error or is killed by a signal, systemd starts it again after 42 seconds (RestartSec). Nginx has no Restart= line, so it stays down. |
WantedBy |
multi-user.target, the same as Nginx. |
KillMode=process means systemctl stop sshd only stops the main sshd, not your session's sshd processes. That is why restarting sshd in Labs 7 and 16 didn't drop your connection.
Going further: systemctl cat chronyd has Conflicts=ntpd.service. systemd won't run chronyd and the older ntpd at the same time, because both want to set the clock. You meet chronyd in Part 6.
A target is a group of units that systemd starts together, such as "everything a multi-user server needs". Older Linux versions used numbered runlevels for this. RHEL 7 and later use targets, but keep the runlevel names as links so old scripts still work:
| Runlevel | systemd target | What it is |
|---|---|---|
| 0 | poweroff.target |
Shut down and power off. |
| 1 | rescue.target |
Single user, for repairs. No network, root only. |
| 2, 3, 4 | multi-user.target |
Normal server: network and services, text login. |
| 5 | graphical.target |
multi-user.target plus a graphical desktop. |
| 6 | reboot.target |
Restart. |
| none | emergency.target |
Even less than rescue, for when rescue won't start. |
Check the target your server boots into, and list the targets:
systemctl get-default
systemctl list-units --type=target
systemctl list-units --type=target --all
Your server boots into multi-user.target, because you chose a Minimal Install in Lab 1, with no desktop. The first list shows the targets active now, and the second adds the inactive ones.
The old runlevel names are links. Look at them:
ls -l /usr/lib/systemd/system/runlevel*.target
lrwxrwxrwx. 1 root root 15 ... /usr/lib/systemd/system/runlevel0.target -> poweroff.target
lrwxrwxrwx. 1 root root 13 ... /usr/lib/systemd/system/runlevel1.target -> rescue.target
lrwxrwxrwx. 1 root root 17 ... /usr/lib/systemd/system/runlevel2.target -> multi-user.target
lrwxrwxrwx. 1 root root 17 ... /usr/lib/systemd/system/runlevel3.target -> multi-user.target
lrwxrwxrwx. 1 root root 17 ... /usr/lib/systemd/system/runlevel4.target -> multi-user.target
lrwxrwxrwx. 1 root root 16 ... /usr/lib/systemd/system/runlevel5.target -> graphical.target
lrwxrwxrwx. 1 root root 13 ... /usr/lib/systemd/system/runlevel6.target -> reboot.target
Question: Your services from Part 3 are
WantedBy=multi-user.target. Which runlevels would start them?
2, 3, 4 and 5. Runlevels 2 to 4 are multi-user.target, and graphical.target includes multi-user.target.
The rescue target stops almost everything, including the network and sshd, and asks for the root password. It is for repairs, such as a broken config file that stops the server from booting normally. It is like Safe Mode on Windows.
Warning: Do this on the console, not over SSH. Switching to rescue mode ends your SSH session. You need the root password you set in Lab 1.
Open the UTM or VirtualBox console window, and log in as your own user.
Switch to the rescue target:
sudo systemctl rescue
The console asks for the root password:

Type the root password. You get a root prompt (#).
Goal: In rescue mode, count the active targets and compare that with the normal multi-user list you saw above. Check whether sshd and nginx are running. Then go back to the normal target.
list-units command as above. The last lines of its output count the units for you.systemctl is-active takes one or more unit names and prints one word for each.systemctl list-units --type=target
systemctl is-active sshd nginx

About 6 targets are loaded, against more than 10 in multi-user mode, and rescue.target is one of them. is-active prints inactive for both services, so nobody can reach the server over the network.
Go back to the default target:
systemctl default
The services start again. Connect with SSH as usual.
Another way: exit or Ctrl+D, as the rescue screen says.
These systemctl commands replace the older reboot, halt and shutdown commands (which still work):
| Command | What it does |
|---|---|
sudo systemctl reboot |
Shuts down, then starts again. |
sudo systemctl halt |
Stops every process and the CPU, but leaves the power on. You have to restart it from UTM or VirtualBox. |
sudo systemctl poweroff |
Same as halt, then switches the power off. You have to start it from UTM or VirtualBox. |
On your production server, halt or poweroff leaves you locked out until someone starts it for you. On development, try a reboot now, from your SSH session:
sudo systemctl reboot
Your SSH session closes. Wait a minute, connect again, and check:
uptime
systemctl is-active sshd nginx chronyd firewalld
uptime shows the server has been up for a minute or two. All four services are active again, without you starting them, because they are enabled: their WantedBy=multi-user.target links were followed at boot.
Tip: You can use
sudo systemctl poweroffat the end of any lab to shut your development server down cleanly, instead of closing the UTM or VirtualBox window.
timedatectl shows the clock, the time zone, and whether NTP is keeping the clock right:
timedatectl
Local time: Thu 2026-11-12 21:30:02 PST
Universal time: Fri 2026-11-13 05:30:02 UTC
RTC time: Fri 2026-11-13 05:30:02
Time zone: America/Los_Angeles (PST, -0800)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
| Line | What it means |
|---|---|
Local time |
The time in your time zone. |
Universal time |
UTC, the same everywhere. Servers keep their clock in UTC and only change it for display. |
RTC time |
The real-time clock, the hardware clock that keeps time while the server is off. In a VM, the hypervisor provides it. |
Time zone |
How UTC is turned into local time. |
System clock synchronized |
yes when NTP has set the clock. Part 6. |
NTP service |
Whether the NTP service, chronyd, is turned on. |
Change the time zone to New York and compare:
timedatectl list-timezones | grep America/New
sudo timedatectl set-timezone America/New_York
timedatectl | grep "Time zone"
date
date -u
date now shows a local time 3 hours later than Seattle. date -u (UTC) didn't change. Only the way the time is displayed changed, not the clock.
Goal: Set the time zone back to where you are, and check it.
grep.timedatectl list-timezones | grep Los_Angeles
sudo timedatectl set-timezone America/Los_Angeles
timedatectl | grep "Time zone"
Use your own zone if you aren't in the Pacific time zone.
Going further: The time zone is a link. ls -l /etc/localtime points at a file under /usr/share/zoneinfo/, and set-timezone changes the link.
Note: Leave your time zone set correctly. Crontab, which you meet in Lab 20, runs jobs at local times.
A server's clock drifts, a little every day. A VM's clock can fall far behind, for example when your laptop sleeps. NTP fixes this: the server asks time servers on the internet for the time, on UDP port 123, and adjusts its clock to match.
Why it matters:
dnf and git fail.Linux has two NTP programs. ntpd is the original. chronyd, from the chrony package, is newer, handles VMs and laptops that sleep better, and is the default on RHEL. chronyc is its command line tool.
You turned on NTP in the installer in Lab 1, so chrony should already be installed and running. Check:
sudo dnf install -y chrony
rpm -qc chrony
systemctl status chronyd
dnf says Nothing to do if chrony is already installed. rpm -qc (query, config files) lists the package's configuration files. If status shows chronyd is not running, start and enable it in one step with --now:
sudo systemctl enable --now chronyd
sudo timedatectl set-ntp yes
Read the configuration without the comments and blank lines, as in Lab 16:
grep -v "^#\|^$" /etc/chrony.conf
pool 2.rhel.pool.ntp.org iburst
sourcedir /run/chrony-dhcp
driftfile /var/lib/chrony/drift
makestep 1.0 3
rtcsync
keyfile /etc/chrony.keys
ntsdumpdir /var/lib/chrony
leapsectz right/UTC
logdir /var/log/chrony
| Line | What it does |
|---|---|
pool ... iburst |
Uses several servers from the public NTP pool. iburst sends a quick burst of requests at start, so the first sync takes seconds. |
driftfile |
Remembers how fast or slow this clock runs, so chrony can correct it between checks. |
makestep 1.0 3 |
If the clock is more than 1 second out, chrony may step (jump) it, but only in its first 3 updates. After that it slews: it speeds up or slows down the clock a little, so time never jumps backwards under running programs. |
rtcsync |
Copies the right time to the hardware clock (RTC) now and then. |
chronyc sources
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* 203.0.113.10 2 10 377 512 +120us[ +150us] +/- 15ms
^+ 198.51.100.20 2 10 377 600 -310us[ -280us] +/- 22ms
^- 198.51.100.35 3 10 377 550 +2104us[+2104us] +/- 48ms
^? 203.0.113.44 0 6 0 - +0ns[ +0ns] +/- 0ns
Your servers are different, and may show as names.
| Column or mark | What it means |
|---|---|
^* |
The server chrony is synchronized to now. |
^+ |
A good server, combined with the * one. |
^- |
Reachable, but not used. |
^? |
Not reachable (yet). Normal for a minute after chronyd starts. |
Stratum |
How far from a reference clock: stratum 1 is wired to an atomic clock or GPS, stratum 2 asks a stratum 1, and so on. Your server is one more than its source. |
Reach |
The last 8 tries, as an octal number. 377 means all 8 answered. |
Last sample |
How far this server's time was from yours. us is microseconds. |
Then check how well your clock is doing:
chronyc tracking
chronyc sourcestats
In tracking, look at Reference ID (the ^* server), System time (how far off your clock is now, usually a tiny fraction of a second) and Leap status: Normal (synchronized). sourcestats shows how steady each server has been.
In Lab 12 you listed TCP ports with ss -tln. chronyd uses UDP, so use -u:
sudo ss -ulnp | grep chronyd
grep -w 123 /etc/services
UNCONN 0 0 127.0.0.1:323 0.0.0.0:* users:(("chronyd",pid=812,fd=5))
UNCONN 0 0 [::1]:323 [::]:* users:(("chronyd",pid=812,fd=6))
chronyd only listens on port 323, on localhost. That is how chronyc talks to it. It doesn't listen on 123 (ntp in /etc/services), because it is an NTP client: it sends its questions to port 123 on the pool servers and reads the answers. A server only listens on 123 if it gives the time to other machines.
Set the clock to the wrong time and see what fails. set-time refuses while NTP is on, because chronyd would just change it back:
sudo timedatectl set-time "2025-01-01 12:00:00"
Failed to set time: Automatic time synchronization is enabled
Turn NTP off, then set the clock:
sudo timedatectl set-ntp no
systemctl is-active chronyd
sudo timedatectl set-time "2025-01-01 12:00:00"
date
set-ntp no stopped (and disabled) chronyd. Now try an HTTPS site:
curl -I https://www.washington.edu
curl: (60) SSL certificate problem: certificate is not yet valid
The site is fine. Your clock says it is a date before the certificate was issued, so curl refuses it. Turn NTP back on:
sudo timedatectl set-ntp yes
chronyc tracking
date
set-ntp yes starts chronyd again. Because it just started, makestep 1.0 3 lets it jump the clock in its first updates, so date is right within a minute. Run date again if it isn't yet, then try curl once more.
A chronyd that has been running for a long time only slews, which takes far too long to fix a big error. That happens to VMs after a laptop has slept for hours. chronyc makestep tells chronyd to jump the clock now. It needs sudo, otherwise chronyd answers 501 Not authorised:

In that screenshot, dnf failed because the clock was a day behind, and sudo !! (Lab 9) repeated the command with sudo.
Goal: This time set the clock ahead, to 2028-06-01 12:00:00. Check what curl says about the same site, then put the clock right and prove the server is synchronized again.
chronyc makestep.timedatectl has a line that says whether the clock is synchronized.sudo timedatectl set-ntp no
sudo timedatectl set-time "2028-06-01 12:00:00"
curl -I https://www.washington.edu
curl: (60) SSL certificate problem: certificate has expired
This time the certificate's end date has passed, as far as your server knows.
sudo timedatectl set-ntp yes
sudo chronyc makestep
timedatectl | grep "synchronized\|NTP"
chronyc tracking | grep "Leap"
curl -I https://www.washington.edu
System clock synchronized: yes
NTP service: active
Leap status : Normal
curl gets HTTP/2 200 again. makestep answers 200 OK. Running it when the clock is already right does no harm.
Going further: sudo journalctl -u chronyd | tail shows chronyd's log, including a line like System clock wrong by ... seconds when it stepped the clock.
Common Pitfall: Don't leave NTP turned off. Check that
timedatectlshows NTP service: active before you go on.
As in Labs 14 to 16, keep your own notes in your GitLab repository. Start the file:
cd ~/git/gitlab/itfdn-140-inclass-$USER
git pull
echo "# Processes, systemd and time
## Jobs
\`command &\`, \`jobs\`, \`fg %1\`, Ctrl+Z then \`bg\`, \`kill %1\`.
" >> systemd-tips.md
cat systemd-tips.md
Goal: Add at least three more tips or commands to systemd-tips.md, for example about ps, systemctl cat, rescue mode or chronyc. Add a link to the file at the end of README.md. Commit both files in one commit, and push. In GitLab, click the link in your README and check that it opens your notes.
[text to show](file-name).git status and git diff before you commit.vim systemd-tips.md
For example:
## Processes
`ps -ef | grep name`, `pgrep -a name`. `kill PID` sends TERM; `kill -9` only as a last resort.
## systemd
`systemctl cat unit` shows the unit file. `WantedBy=multi-user.target` is what `enable` links.
`systemctl is-active a b c`. Rescue mode: `sudo systemctl rescue` on the console, back with `systemctl default`.
## Time
`timedatectl`, `chronyc sources`, `chronyc tracking`. Clock far out: `sudo chronyc makestep`.
Add the link, then check, commit and push:
echo "" >> README.md
echo "[Processes, systemd and time](systemd-tips.md)" >> README.md
git status
git diff
git add README.md systemd-tips.md
git commit -m "docs: add systemd tips and link from README"
git push
git log --oneline
You have now:
&, and moved them with fg, bg, Ctrl+Z and Ctrl+C.ps, pgrep and top, and stopped one with a signal from kill.enable makes the links it does.chronyc makestep.Your time zone and NTP are back to normal, and the loops from Parts 1 and 2 are stopped.
kill PID usually work better than kill -9 PID?systemctl enable enough for a service to start after a reboot? What does it read from the unit file?Q. jobs shows nothing, but my loop is still writing to the log.
A. Jobs belong to the shell that started them. If you started the loop in another session, or logged out and back in, your new shell doesn't know about it. Find it with ps -ef | grep sleep. The PPID of the sleep is the loop, so kill that PID.
Q. When I log out it says "There are stopped jobs."
A. A job is paused with Ctrl+Z. Run jobs, then kill %N or fg and Ctrl+C. Logging out a second time also ends it.
Q. kill says "No such process".
A. The process had already ended, or you mistyped the PID. Run ps -fj again. Remember a new sleep gets a new PID every few seconds.
Q. systemctl reboot asks for a password or says "Interactive authentication required".
A. Use sudo systemctl reboot. Changing the system state needs root.
Q. Rescue mode says "Cannot open access to console, the root account is locked."
A. Root has no password. Press Enter to continue to the normal target. Then, back over SSH, set one with sudo passwd root, as in Lab 1, and try again.
Q. I can't connect with SSH after rescue mode.
A. You are probably still in rescue mode. On the console, run systemctl default as root, or exit. If that doesn't work, run systemctl reboot.
Q. timedatectl set-time says "Automatic time synchronization is enabled".
A. Turn NTP off first with sudo timedatectl set-ntp no. Turn it on again when you are done.
Q. curl didn't show a certificate error.
A. Check date. If the clock is right, chronyd was still running and changed it back. Check timedatectl | grep NTP says inactive, then set the time again.
Q. sudo asks for my password again after I changed the clock.
A. That is normal. sudo remembers your password for a few minutes, and a clock that jumps makes it forget.
Q. chronyc sources shows only ^? lines.
A. chronyd can't reach any time server. Wait a minute after it starts. If it stays that way, check the server can reach the internet with ping -c 3 8.8.8.8 and dig +short 2.rhel.pool.ntp.org, as in Labs 12 and 13. Some networks block UDP port 123.
Q. chronyc makestep says "501 Not authorised".
A. Use sudo chronyc makestep.
Q. git push is rejected.
A. Your GitLab repository has a change you don't have yet. Run git pull, then git push again, as in Lab 10.
If you can't solve a problem, post it in this week's Teams channel, or reach out by email for help.
Lab complete