Content of this week's job:
1. Copy the/etc/rc.d/rc.sysinit file to the/tmp directory and add # to the beginning of the line with at least one whitespace character in the/tmp/rc.sysinit file;
Cp-a/etc/rc.d/rc.sysinit/tmp && sed ' s/^[[:space:]]/#&/g '/tmp/rc.sysinit
2, copy/boot/grub/grub.conf to/tmp directory, delete the blank character of the beginning of the/tmp/grub.conf file;
Cp-a/boot/grub/grub.conf/tmp && sed ' s/^[[:space:]]+/d '/tmp/grub.conf
3. Remove the # and white space characters from the/tmp/rc.sysinit file that begin with # and followed by at least one white-space character
Sed ' s/^[[:space:]]+/d/tmp/rc.sysinit
4. Add # to the beginning of the first three lines in the/tmp/grub.conf file;
Sed ' ^,3p s/.*/#&/'/tmp/grub.conf
5. Change the last 0 of all enabled=0 or gpgcheck=0 in the/etc/yum.repos.d/centos-media.repo file to 1;
Sed ' s/enabled=0/enabled=1/'/etc/yum.repos.d/centos-media.repo
6, every 4 hours to perform a backup of the/etc directory, back up to the/backup directory, save the directory named Shape etc-201608300202
* */4 * * */bin/cp-a/etc/backup/etc-' date +%
7, weekly 2,4,6 backup/var/log/messages file to/backup/messages_logs/directory, save the file name like messages-20160830
* * * * * 2,4,6 tar-cf/var/log/messages/backup/messages_logs/messages-' date +%
8, every two hours every day to take the current system/proc/meminfo file in the beginning of all the information in the S./stats/memory.txt file
* */2 * * */bin/ls/proc/meminfo |/bin/grep "^s" >>/stats/memory.txt
9, working days of work time, every two hours to perform the echo "Howdy"
Script Programming Exercises
* */2 * * 1-5/bin/echo "Howdy"
10, create the directory/tmp/testdir-the current date and time;
mkdir/tmp/testdir-' Date
11. Create 100 empty files in this directory: file1-file100
Touch file ' seq1,100 '
12. Display the user name of the user who is located in the/ETC/PASSW D file in the first even row;
13. Create 10 user user10-user19, password and user name;
14, create 10 empty files file10-file19 in/tmp/;
15. Change the file10 and the genus to user10, and so on.
Week six Homework