Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Linux Service Management Made Easy with systemd

You're reading from   Linux Service Management Made Easy with systemd Advanced techniques to effectively manage, control, and monitor Linux systems and services

Arrow left icon
Product type Paperback
Published in Feb 2022
Publisher Packt
ISBN-13 9781801811644
Length 420 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Donald A. Tevault Donald A. Tevault
Author Profile Icon Donald A. Tevault
Donald A. Tevault
Arrow right icon
View More author details
Toc

Table of Contents (23) Chapters Close

Preface 1. Section 1: Using systemd
2. Chapter 1: Understanding the Need for systemd FREE CHAPTER 3. Chapter 2: Understanding systemd Directories and Files 4. Chapter 3: Understanding Service, Path, and Socket Units 5. Chapter 4: Controlling systemd Services 6. Chapter 5: Creating and Editing Services 7. Chapter 6: Understanding systemd Targets 8. Chapter 7: Understanding systemd Timers 9. Chapter 8: Understanding the systemd Boot Process 10. Chapter 9: Setting System Parameters 11. Chapter 10: Understanding Shutdown and Reboot Commands 12. Section 2: Understanding cgroups
13. Chapter 11: Understanding cgroups Version 1 14. Chapter 12: Controlling Resource Usage with cgroups Version 1 15. Chapter 13: Understanding cgroup Version 2 16. Section 3: Logging, Timekeeping, Networking, and Booting
17. Chapter 14: Using journald 18. Chapter 15: Using systemd-networkd and systemd-resolved 19. Chapter 16: Understanding Timekeeping with systemd 20. Chapter 17: Understanding systemd and Bootloaders 21. Chapter 18: Understanding systemd-logind 22. Other Books You May Enjoy

Understanding path units

You can use a path unit to have systemd monitor a certain file or directory to see when it changes. When systemd detects that the file or directory has changed, it will activate the specified service. We'll use the Common Unix Printing System (CUPS) as an example.

In the /lib/systemd/system/cups.path file, we see this:

[Unit]
Description=CUPS Scheduler
PartOf=cups.service
[Path]
PathExists=/var/cache/cups/org.cups.cupsd
[Install]
WantedBy=multi-user.target

The PathExists= line tells systemd to monitor a specific file for changes, which in this case is the /var/cache/cups/org.cups.cupsd file. If systemd detects any changes to this file, it will activate the printing service.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image