Linux Basic Knowledge day-7

Source: Internet
Author: User

NFS Services

1) The NFS (Network File system) is a networked filesystem that allows sharing of resources across TCP/IP networks among computers in the network. NFS relies on the RPC protocol during file transfer or information transfer. RPC, remote procedure invocation (Procedure call) is a mechanism that enables clients to perform programs in other systems. NFS itself does not provide the protocol and functionality for transmitting information, but NFS allows us to share information over the network, because NFS uses some other transport protocols. And these transport protocols are used for this RPC function.

2) NFS configuration file location:/etc/exports.

3) NFS configuration file format:

< shared directory > < client 1> (options) < client 2> (option)

Shared directory: The directory that the NFS server shares to the client

Client: The network can access the shared host, multiple clients use a space separate

Options: Set permissions for the directory, user mappings, and so on. Multiple options are separated with commas.

Common options include:

Sync : Performs the input and output actions of the file system in a synchronous manner. Async: Performs an asynchronous file system input and output action in an unsynchronized manner. ro: Loaded in read-only mode. RW: Load in read/write mode.
defaults: Use the default options. The default options are RW, suid, dev, exec, Anto Nouser, and async. atime: Each access updates the Inode's access time, the default setting, and the Cancel option is noatime. Noatime: The Inode's access time is not updated on each access.

Examples of exports file contents:

/share  *(rw,sync)/share_1        192.168.16.185 (rw,sync) 192.168.16.132 (Ro,sync)

 4) need to install Nfs-utils Rpcbind two packages, client service side need to install.

[[email protected] YUM.REPOS.D] # Yum Install  rpcbind nfs-utils

 5) Start the service. The client service side needs to start the service.

[[email protected] YUM.REPOS.D] # systemctl start Rpcbind [[email protected] YUM.REPOS.D] # Systemctl start NFS

 6) The client uses SHOWMOUNT-E [server-side IP] to view the share.

[[email protected] YUM.REPOS.D] # showmount-e 192.168.16.132  for 192.168.16.132:/share   */share_1 192.168.16.132,192.168.16.185[email protected] -2 yum.repos.d]#

 7) The client uses the Mount command to mount the share to local use.

[[email protected]/]#Mount 192.168.16.132:/share/nfsshare[[email protected]/]#DFFilesystem 1k-blocks used Available use%mounted on/dev/mapper/cl-root 6486016 4881956 1604060 76%/Devtmpfs225112 0 225112 0%/Devtmpfs241928 0 241928 0%/dev/Shmtmpfs241928 5048 236880 3%/Runtmpfs241928 0 241928 0%/sys/fs/Cgroup/DEV/SDA1 1038336 160316 878020 16%/Boottmpfs48388 0 48388 0%/run/user/0192.168.16.132:/share 6486016 4761344 1724672 74%/ nfsshare[[email protected]-2/]#

 8) If the firewall is turned on, release Rpc-bind,nfs,mountd is required.

[[email protected]/] # firewall-cmd--permanent--add-service=rpc-bind Success[[email protected]-2/] # firewall-cmd--permanent--add-service=nfs Success[[email protected]-2/] # firewall-cmd--permanent--add-service=mountd Success[[email protected]-2/] # Firewall-cmd--reload Success[[email protected]-2/] #

Crond Scheduled Tasks

1) Crond is a daemon that is used to periodically perform certain tasks or wait for certain events under Linux, similar to Scheduled tasks under Windows, when the operating system is installed, the Service tool is installed by default and the Crond process is started automatically. The Crond process periodically checks to see if there is a task to perform and automatically executes the task if there are tasks to perform.

2) Crond services are divided into system planning tasks and user scheduled tasks.

System-Level Scheduled tasks: Modify the configuration file/etc/crontab file to create a scheduled task.

User-level Scheduled tasks: Normal users edit their own scheduled tasks directly using the CRONTAB-E command. The root administrator can use crontab-e-u [user name] To modify a user's scheduled tasks. All user-defined crontab files are saved in the/var/spool/cron directory.

3) crontab file format: Both user-level and system-level file formats are the same. 

  # Example of Job definition:
#.----------------minute (0-59)//min (0-59)
# |.-------------hour (0-23)//h (0-23)
# | |.----------DAY of Month (1-31)//Date (1-31)
# | | |.-------month (1-12) OR jan,feb,mar,apr ... Month (1-12) or use the English abbreviation of the Month
# | | | |.----DAY of Week (0-6) (sunday=0 or 7) or Sun,mon,tue,wed,thu,fri,sat//days of the Week (0-6) or English shorthand for the use of the week
# | | | | |
# * * * * * * user-name command to be executed//username: Who will perform this task command to be executed: the command to execute

4) crontab Command parameters:

-U: Specify user

-E: Editing a user scheduled task

-L: Displays the contents of a user's scheduled tasks

-R: Delete a user's scheduled tasks

-I: Prompt for confirmation when deleting user files

5) Example:

Example 1: The command command executes every 1 minutes:* * * * *Command Instance 2: the 3rd and 15 minutes of the hour are executed:3,15 * * * *Command Instance 3: Execute commands at 3rd and 15 minutes from 8 o'clock in the morning to 11:3,15 8-11 * * *Command Example 4: Every two days from 8 o'clock in the morning to 11 points in the 3rd and 15 minutes of the execution of the commands:3,15 8-11 */2 * *Command Instance 5: Every Monday from 8 o'clock in the morning to 11 in the 3rd and 15 minutes execution of commands:3,15 8-11 * * 1Command instance 6:21:30 restart SMB command per night:* * * */etc/init.d/SMB Restart Instance 7:1 per month,10, the 4:45 restart SMB command on 22nd:4 1,10,22 * */etc/init.d/SMB Restart Instance 8:1:10 restart SMB command per Saturday, Sunday:1 * * 6,0/etc/init.d/SMB Restart Instance 9: Restart the SMB command every 30 minutes from 18:00 to 23:00 daily: 0,18-23 * * */etc/init.d/SMB Restart Instance 10: Every Saturday night:00pm Restart SMB command: 0* * 6/etc/init.d/SMB Restart Instance 11: Restart SMB command every hour:* */1 * * */etc/init.d/SMB Restart Instance 12: From 11 o'clock to 7 in the morning, restart the SMB command every hour:* 23-7/1 * * */etc/init.d/SMB Restart Instance 13:4th for each month with 11 points per Monday to Wednesday restart SMB command: 04 * mon-wed/etc/init.d/SMB Restart Instance 14: January 1 4-point restart SMB command: 04 1 Jan */etc/init.d/SMB Restart Instance 15: Hourly Execution/etc/script commands in the Cron.hourly directory:* * * * * Root run-parts/etc/cron.hourly

Linux Basic Knowledge day-7

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.