Question
Managing services from the command line QUESTION BOLDED You can also control services using /sbin/service servicename command where servicename is the name of the service
Managing services from the command line
QUESTION BOLDED
You can also control services using /sbin/service servicename command where servicename is the name of the service (e.g., dnsmasq, netfs, httpd) and command is start, stop, restart or status, as in /sbin/service network restart. You can also directly control the service using /etc/init.d/servicename command as in /etc/init.d network stop, or from within /etc/init.d as ./network stop. What is the status of network? Restart network from the command line (use start instead of status for the command). What command did you enter? What message(s) appears?
Stop the network service. What command did you enter? Type ip addr. What is your IPv4 address now? Restart your network service and make sure you have an IP address.
We now explore service configuration files in /etc.
Look at anacrontab. What service uses this file? At the bottom of this file it has a schedule for cron.daily, cron.weekly and cron.monthly. Look at these directories as specified at the bottom of this file. What specific processes are scheduled daily? Weekly? Monthly?
One of the daily activities is to run cups, which is a script. Examine this script and you will see that it iterates through all files in /var/spool/cups/tmp and executes tmpwatch on them. Review the man page for tmpwatch and then explain what this script is doing (note: since we are not using the printer, we will have no files in /var/spool/cups/tmp, but this directory will typically store waiting print jobs).
Cd to /etc/audit. What contents do you find in the directory audit? What is the difference between a configuration file and a rules file?
Return to /etc. Look at the file dnsmasq.conf. What service uses this configuration file? Look at the exports file. It should be empty. What service uses this file? Hint: remember the command apropos!
Explore the services file. What type of information do you find stored here?
Cd to /etc/init.d and examine the script file auditd. You will see chkconfig 2345 11 88. What does 2345 represent? What do 11 and 88 mean?
Examine the file rsyslog. Look at the start function, which is invoked if you try to start this service. Explain line-by-line what this function does. HINT: review the examination of the atd script in chapter 11.
Imagine we want to add another command to rsyslogd, uptime. This will return the time that the service was last started. We can obtain this from doing an ls l on the file /var/lock/subsys/rsyslog. How would we enhance this script file to permit this new command? Be complete in your answer.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started