Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the process of service booting in LINUX

2025-01-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "what is the process of service guidance in LINUX". In daily operation, I believe that many people have doubts about the process of service guidance in LINUX. The editor has consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "what is the process of service guidance in LINUX?" Next, please follow the editor to study!

one。 Boot process Management 1.1 Boot process Overview

1.2 init process

/ sbin/init program is loaded and run by the linux kernel

Is the first process in the system, and the PID (process tag) number is always 1

Configuration file: / etc/inittab

1.3 structure of inittab files

X: 5: respawn: / etc/X11/prefdm-nodaemon

Id runlevels field action field prcocess field

Field description id is used to uniquely identify a configuration record in the inittab file runlevels is used to specify the runlevels in which the record runs action is used to describe what type of action the record will perform process is used to set the commands executed by the startup process

1.4 rc.sysinit script file

Path / etc/rc.d/rc.sysinit

Called and executed by the init process

Complete initialization tasks such as setting network, hostname, loading file system, etc.

1.5 rc script Fil

/ etc/rc.d/rc script file

There are init process calls to execute

Load or terminate the corresponding system services according to the specified run level

1.6 rc.local script Fil

/ etc/rc.local script file

Called and executed by rc script

Save user-defined commands that need to be automatically executed after boot

1.7 service system Service Control

Syntax: service [service name] [control type]

/ etc/rc.d/init.d [server name] [control type]

Control type

Start: start

Stop: stop

Restart: restart

Reload: reloading

Status: viewing service statu

-- status-all: view the status of all services

1.8Runtime level of linux system

Init

Syntax: init [level parameter]

Level parameter

0-halt / / off

1-/ / maintenance mode

2-/ / only do NFS (network file system) between unix systems

3-/ / character pattern

4-unused / / hold

5-X11 / / graphic mode

6-reboot / / restart

two。 System Optimization 2.1 system Service Management 2.1.1 ntsysv tool

Command: ntsysv

Call a specific level level and turn on or off the settings for that level of service

Ntsysv-- level [level number]

Chkconfig management tools

View the enabled status of all services

Syntax: chkconfig

View the status of a particular service

Syntax: chkconfig-- list [service name]

Set the startup status of the system service

Syntax: chkconfig-- level [level list] [Service name] on | off

2.2 process Management 2.2.1 View process information

Ps

Syntax: ps aux

Ps-elf

Top

Purpose: view dynamic process ranking information (equivalent to processes in the task manager in windows)

Pgrep

Purpose: query process PID information according to specific conditions

Syntax: pgrep "name of the service process"

Syntax: pgrep [options] [parameters]

Option

-l / / displays the process name

-U / / specify a specific user

-t / / designated terminal

2.2.2 View the process in a tree

Pstree

Pstree [options]

Option

-a / / display complete information

-u / / list the corresponding user name

-p / / list the corresponding PID

2.3 enablement of processes 2.3.1 start manually

Foreground startup: the user executes the command and executes the program directly. You need to wait for the command to finish before you can do other operations.

Start in the background: add a "&" symbol at the end of the command line to let the current command line execute itself in the background

Call the foreground and background of the process

2.3.2 Ctrl+z key combination

Suspend the currently executed process, call it to the background, and suspend execution

Jobs

View the list of tasks in the background

Fg

Restore the process in the background to the foreground and specify the task sequence number

2.4 terminating the operation of the process

Ctrl+c key combination

Interrupt the command in progress

Kill termination command

Kill-9 7669 / / terminates the process with a specified PID number

Killall-9 vim / / terminates all vim processes

Pkill termination command

Purpose: terminate the corresponding process according to specific conditions

Option

-U: terminates the process according to the user name to which the process belongs

-t: terminate the corresponding process according to the terminal where the process is located

Pkil-9-U "admin" / / terminates all processes in admin

three。 Scheduled Task Management 3.1 one-time scheduled Task Management

Creating: scheduling tasks at once

Syntax: at [HH:MM] [yyyy-mm-dd]

The scheduled task ctrl+d that needs to be performed (perform this scheduled task)

View a list of unperformed tasks

Atq

Delete the corresponding task

Atrm [Task number]

3.2 set up periodic tasks

Crond

Edit scheduled tasks: crontab-e [- u user name]

View scheduled tasks: crontab-l [- u user name]

Delete scheduled task: crontab-r [- u user name]

3.2.1 format of task configuration

Minute, hour, date, month, week, task content

3.2.2 Special representation of time numbers

*: indicates any time within this range

Represents multiple discontiguous points in time at intervals

-: represents a continuous time range

/: specify the time frequency of the interval

3.2.3 Application time format

0 17 * 1-5 / / 17:00 every day from Monday to Friday

308 * / 08:30 every Monday, Wednesday and Friday

0 8-18 take 2 * 8 / / every 2 hours between 0 8 and 18:00

* 0 * / 3 * / every 3 days

Syntax: crontab-e [edit time conditions] [write actions to be performed] (commands used, must be

Use the absolute path of the command)

Syntax: crontab-e-u [user name] [edit time condition] [write actions to be performed]

Note: (this syntax applies to importing system files into another user's home directory, and you need to get the owner.

Permissions)

Crontab-l / / View periodic tasks

Crontab-l-u [user name] / / View a user's scheduled task

Crontab-r-u [user name] / / Delete a user's scheduled task

four。 System fault analysis and troubleshooting 4.1 main log files

Kernel and Common message Log: / var/log/messages

Scheduled task log: / var/log/cron

System boot log: / var/log/dmesg

Mail Syslog: / var/log/maillog

User login log: / var/log/lastlog, / var/log/secure, / var/log/wtmp, / var/run/btmp

4.2 log message level

0 EMERG (emergency): a condition that can cause the host system to become unavailable

1 ALERT (warning): problems that must be solved immediately

2 CRIT (serious): a more serious situation

3 ERR (error): error occurred when running

4 WARNING (reminder): events that may affect system function

5 NOTICE (note): does not affect the system but is noteworthy

6. INFO (information): general information

7. DEBUG: program or system debugging information, etc.

4.3 user log path

/ var/log/lastlog: last time the user logged in

/ var/log/vtmp: user login, logout and system on / off events

/ var/run/utmp: details of each user currently logged in

/ var/log/secure: security events related to user authentication

4.4 Analysis tools

Users 、 who 、 w 、 last 、 lastb

Fix MBR sector failure

Backing up MBR sector data

Dd if=/dev/sda of=/backup/sda.mbr.bak bs=512 count=1

Simulate the failure of MBR being destroyed

Dd if=/dev/zero of=/dev/sda bs=512 count=1

The corresponding version of RHEL is booted on CD-ROM. Do you want to enter first aid mode?

Boot:linux rescue

Restore MBR sectors from backup files

Dd if=/tempdir/sda.mbr.bak of=/dev/sda bs=512 count=1

4.5 reset root user password

1. Boot boot system

two。 Enter the e key in the GRUB boot interface, in the e key, select the second item, and then press the e key to change the order after table=/ to 1 or single

3. Press the b key to boot

4. Enter sh-3.1# / / maintenance mode

5. Enter passwd root

6. Enter the password (do not display the password) and determine the password

7. Enter exit to log out and restart

At this point, the study of "what is the process of service guidance in LINUX" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report