9 Services Flashcards
services
interactive programs run in the background users can interact with
ex: web service users can interact with
daemons
noninteractive programs running on the system and don’t communicate with users
ex: httpd is required to make web service run
what is systemd?
software suit that provides an init method/daemon
improvements over SysVinit
support parallelization (starting programs at the same time). us Control Groups (cgroups) instead of PID for petter categorization and isolation
systemd service commands of systemctl
systemctl {subcommand} {service}
start
stop
restart
enable
disable
status
mask -creates a sym link to /dev/null to prevent starting service
unit vs unit files
the term unit describes a resource systemd knows how to manage
unit file defines how the unit must be manages by systemd
/lib/systemd/system
house default unit files
/etc/systemd/system
configurations managed here and changes to these files override settings default unit settings in /lib but it doesn’t overwrite the file with new configurations
.service files directives
Before=
-this will start before any unit in this field
After=
-when multiple units are specified, this unit will start after any unit listed
Requires=
-Units listed will be started if possible, and the primary unit will fail if the units specified by Requires= fail to start
Wants=
-Units listed will be started if possible, but the primary unit will still launch even if the units specified by Wants= fail to start
Type=
-Configures the startup type for the service; Values include simple, exec, forking, oneshot, dbus, notify, and idle
User=
-Specifies the user under whose authority the service runs (usually root)
ExecStart=
-Executes commands along a specified absolute path upon startup to start a service
ExecStop=
-Executes commands along a specified absolute path upon shutdown to stop a service
Timer unit files directives
OnBootSec - (monotonic) time spanning from an even such as system startup
OnCalender - (realtime) time referenced from system clock
OnCalender format for timer unit files
{day of the week: Fri} (Year-Month-Day) (Hour:Min:Sec) –>
- --* ::*
*/ in a field of {clock time} - specifies whenever this amount of time passes (not the time of day) in clocks field containing this, the value associated and what after matches value execute
ex: :/30:00
in the minute field and associated value is 30 so at least every 30 min, and whatever is after
.mount unit files options
What=
-Absolute path to storage to mount
Where=
-Absolute path to mount point directory
Type=
-Define the filesystem type (optional)
Options=
-Any additional required options for the mount action
systemd unit files use dashes as a delimiter for paths when read
common .target unit files
default -The target to which the system boots by default
multi-user.target - Starts the enable services and the system to the CLI
graphical.target - Starts the enable services and the system to the GUI
network-online - Starts the specified network services, and delays the target until network service is established
systemctl get-default
display default target
systemctl isolate {graphical | multi-user}.target
swap system to graphical or multi-user target.
temporary?
/etc/rsyslog.conf
main rsyslog configurations file
/etc/rsyslog.d/50-default.conf
additional configurations r syslog file
cron.error -/var/log/cron
logs all cron messages from error and upwards to /var/log/cron
/var/log/syslog
/var/log/messages
general system logs for 1. Debian 2. Red hat derivatives
Log location for rsyslog daemon