RH133读书 笔记(4) - Lab 4 System Services

本文介绍了一个包含三个实验序列的系统管理课程:使用cron任务监控系统资源;设置集中式日志服务器;配置和管理CUPS打印机服务。通过这些实践,读者可以掌握如何利用系统管理工具和技术来提高系统的可维护性和效率。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Lab 4 System Services

Goal: Develop skills using system administration tools and setting up and administering CUPS.

Estimated Duration: 30

Sequence 1: Using cron

Scenario: You want to know some information about the status of the system every ten minutes today to help investigate some performance issues you have been having. You suspect it might be memory or I/O related and want to keep an eye on those resources.

Deliverable: A cron job that runs every ten minutes today between the hours of 0800 (8:00 AM) and 1700 (5:00 PM).

Instructions:

1. Using crontab -e create a cron job that executes /usr/bin/free and /bin/ps every 10 minutes between 0800 (8:00 am) and 1750 (5:50 pm).

a. As root, use the command crontab -e to edit your cron file. (If you are not comfortable with vi, export an EDITOR environment variable to set another editor.)

b. Enter the following line in your crontab file:

*/10 8-17 * * * /usr/bin/free; /bin/ps

2. How could you send the output from these cron jobs to another e-mail address?

You can set the MAILTO=user variable or use command | mail -s test user

3. Use mail, or mutt as root to check for email from the cron job you have scheduled.

4. Be sure to delete your cron job when you have received several emails from it.

Sequence 2: Logging to a centralized log host

Scenario: Your boss thinks it is a great idea to have one central logging host.

Work together with your neighbor. Set up one machine as the log server and the other as a log client

Instructions:

1. First, on the log server set up syslogd to accept remote messages.

a. Edit /etc/sysconfig/syslog:

SYSLOGD_OPTIONS=“-r -m 0”

b. Restart syslogd:

# service syslog restart

2. On the log client set up syslogd to send messages from the user facility to the log server.

a. Append in /etc/syslog.conf the following line:

user.* @192.168.0.X

b. Restart syslogd.

# service syslog restart

3. Test the new setup by using logger to generate a syslog message. Does the message appear in your neighbor's /var/log/messages?

# logger -i -t yourname "This is a test"

Sequence 3: Setting up a printer and administering a printer with CUPS.

Instructions:

1. Use system-config-printer to create a local queue named testprinter using the generic Postscript printer driver

a. As root run system-config-printer or select System->Administration->Printing in the graphical interface.

b. Click New Printer

c. Enter the text: testprinter in the Printer Name field and click Forward.

d. Select Serial Port #1 from the Select Connection. This describes a locally-connected printer. Click Forward.

e. Select Generic from the Makes list and click Forward.

f. Scroll down to and select Postscript Printer from the Models list and click Forward.

g. Click Apply.

h. After a short pause, you should see your new printer in the Local Printers section of the main interface.

2. Make testprinter your default printer and print a test page.

a. Select testprinter from system-config-printer's Local Printers list to display its settings interface. Note that there are many new configuration options available once the printer has been created.

b. Click Make Default Printer.

c. Click Print Test Page. Click OK in the confirmation dialog.

d. If you are using Gnome, a printer icon should appear in in the corner of your screen. Click this icon and you will see your test page waiting to print. Since your printer does not actually exist, this will never happen, so you may wish to remove the print job by right-clicking on it and selecting Cancel Documents.

3. Use the lp command to print the file /root/install.log from the command line. Since you do not have a real printer attached, this job will be queued forever. Verify the status of the print queue with lpstat and then remove the print job with cancel.

a. # lp /root/install.log

b. # lpstat

(Note: you should see at least one print job active for root with Job number 1. If your test page is still in the queue, you should see it as well)

c. Type the command: cancel 1 to remove the job.

d. Type the command: lpstat The job should now be removed.

转载于:https://www.cnblogs.com/thlzhf/p/3472062.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值