Topic 10 – Services and daemons Flashcards
this linux command will search the process list for the process named “galulator” and if there is a match will output its PID to the STDOUT
what is the outcome of typing the linux command
Pgrep “galculator”
this command will use the SIGKILL signal and the OS will terminate the process immediately
what is the outcome of typing the linux command
Kill -SIGKILL pid
or
Kill -9 pid
this will immediately stop the cron daemon
what is the outcome of typing the linux command
Sudo systemctl stop cron
what is the outcome of using the hotkey
Ctrl + z
in the linux terminal
this hotkey will suspend a process allowing it to be restarted at a later date
describe the process signal
SIGTERM
this will terminate a process and acts similarly to ending a process via the quit button provided
this can be caught or ignored by a process
while editing the crontable on exit this command will be added to the crontable and will run the command date >>/home/pi/date.log every 1 minute
while editing the cron table what is the outcome of adding this job
*/1 * * * * date >> /home/pi/date.log
this will display a list of processes/commands that are either running in the background or have been suspended
some deatils provided by the command are:
- Job number
- The jobs status such as running,suspended, terminated
- The command that executed the process
what is the outcome of typing the linux command
jobs
and what 3 details does it provide
this will disable the cron daemon on the next reboot
(does not immediately stop the deamon)
what is the outcome of typing the linux command
Sudo systemctl disable cron
this linux command will search the process list for the process named “galulator” and if there is a match will output its PID and process name to the STDOUT
what is the outcome of typing the linux command
Pgrep -l “galculator”
what is the outcome of typing the linux command
Kill -SIGKILL pid
or
Kill -9 pid
this command will use the SIGKILL signal and the OS will terminate the process immediately
this will execute the command in the background and hand back control of the terminal to the user
what is the outcome of typing the linux command
Command &
this linux command will kill all processes that have a match with the name given
what is the linux command
Killall “process name”
used for
this can be achieved by sending a signal to the process or to the OS via the terminal
if the signal is sent to the process then it will be given the chance to end cleanly: saving any data and closing any of its elements correctly
if the signal is sent to the OS then the operating system may just end the process giving it no chance to end cleanly. this may be necessary if the above will not work
how can “out of control” processes be terminated within linux
these include:
- SIGINT
- SIGQUIT
- SIGILL
- SIGKILL
- SIGTERM
- SIGSTP
- SIGCONT
name 7 portable operating system intercae (POSIX) signals that may be sent to the OS or a process in order to terminate or suspend the process
what is the outcome of typing the linux command
Kill pid
this will use the SIGTERM signal and allow the procss given a chance to end cleanly, it is similar to pressing the close button on a GUI application
while making an entry to the cron table what is the outcome of using
*
in any of the time fields
while editing the time fields in the cron table this will denote that any value of this time type is valid for the time execution
while making an entry to the cron table what is the outcome of using
*/value
in any of the time fields
whileediting the cron table:
using this within any of the time fields will denote that the job should be executed at the given interval for that time type
example
- every 1 minute
- every 5 minute
- every 5 day of week (every 5th day of the week)
- every 6 hours
- etc
what is the outcome of typing the linux command
jobs
and what 3 details does it provide
this will display a list of processes/commands that are either running in the background or have been suspended
some deatils provided by the command are:
- Job number
- The jobs status such as running,suspended, terminated
- The command that executed the process
while editing the cron table what is the outcome of adding this job
*/1 * * * * date >> /home/pi/date.log
while editing the crontable on exit this command will be added to the crontable and will run the command date >>/home/pi/date.log every 1 minute
this command is used to edit the current crontab
what is the outcome of typing the linux command
Crontab -e
while inside the terminal:
this command can be used to start jobs running in the background that are in the jobs list
note
while the process is running in the background the terminal is free to execute further commands
what is the outcome of typing the linux command
bg %number of process in jobs list
these processes will usually have its name ending in a d or will include the word daemon within the process name
within linux how can a
daemon be differentiated from a normal process
these could be but are not limited to:
- bluetooth
- DHCP
- task scheduler
name 3 types of background services
how can “out of control” processes be terminated within linux
this can be achieved by sending a signal to the process or to the OS via the terminal
if the signal is sent to the process then it will be given the chance to end cleanly: saving any data and closing any of its elements correctly
if the signal is sent to the OS then the operating system may just end the process giving it no chance to end cleanly. this may be necessary if the above will not work
what is the outcome of typing the linux command
Sudo systemctl stop cron
this will immediately stop the cron daemon
this will output the last few lines from the file located at ~/date.log
what is the outcome of typing the linux command
Tail ~/date.log
these are anything that is handled through the sytemd daemon and can perform a specific task
example units include:
- service
- device
- swap
in the context of systemd what are units and name 3 types
within the scope of systemd terminilogy
- what is a daemon
- what is a service
within the context of systemd
- a daemon is a type of service
- a service is a type of unit
what is the outcome of using the hotkey
Ctrl + c
in the linux terminal
this hotkey will terminate a process
name 3 types of background services
these could be but are not limited to:
- bluetooth
- DHCP
- task scheduler
whileediting the cron table:
using this within any of the time fields will denote that the job should be executed at the given interval for that time type
example
- every 1 minute
- every 5 minute
- every 5 day of week (every 5th day of the week)
- every 6 hours
- etc
while making an entry to the cron table what is the outcome of using
*/value
in any of the time fields
name 7 portable operating system intercae (POSIX) signals that may be sent to the OS or a process in order to terminate or suspend the process
these include:
- SIGINT
- SIGQUIT
- SIGILL
- SIGKILL
- SIGTERM
- SIGSTP
- SIGCONT
describe the process signal
SIGCONT
this will continue a process if it is stopped
this process signal may be used when the command
bg %number in jobs lists
or
fg %number in jobs lists
is used on a stopped process
what is the outcome of typing the linux command
Systemctl status cron
this will display the status of the cron daemon
what is the outcome of typing the linux command
Kill -l
this will display a list of signals provided by the os that may be used to terminate or pause a process
describe the process signal
SIGINT
this will terminate a process and is the same signal that is sued by the hotkey ctrl + c