Original: http://www.cnblogs.com/mickole/p/3188321.html, Guardian process overviewLinux Daemon (daemon) is a special process running in the background. It is independent of the control terminal and periodically performs some sort of task or waits to handle certain occurrences. It does not require user input to be able to run and provide a service, not the entire system is to a user program services. Most of
, which is very dangerous. We will introduce vsftp later!
Virtual users (also called GUEST users in some places ):Using an independent account/password data file, this account has a feature that it can only access its own home directory. In this way, the server ensures the security of other files on the FTP service. This type of account, in VsftpdSoftwareIs called a Guest user. Accounts with such users can only access the directories in their home dir
Create child process, parent process exitsThis is the first step in the process of writing a daemon. Since the daemon is detached from the control terminal, the first step is to create the illusion that a program has been completed in the shell terminal. All subsequent work is done in the subprocess, and the user can execute other commands in the shell terminal, thus achieving a formal separation from the c
Create a daemon in Linux
01-7-27 10:30:08 AM
There are many ways to create a daemon in Linux. For example, you can use programs such as cron and inetd to create a daemon. Here we will introduce the daemon
Linux Process Groups, sessions, and daemon
I. Process Group ID
Each process belongs to a process group. Each process group has a leading process. A process group is a collection of one or more processes. Generally, it is associated with a group of jobs and can receive various signals from the same terminal. Each process group has a unique process group ID (an integer, which can also be stored in the pid_t t
", does a process become a daemon? Or, after the user exits the session, will "background tasks" continue to execute?The Linux system is designed like this.
User ready to exit session
The system sends a signal to the session SIGHUP
Session sends the SIGHUP signal to all child processes
SIGHUPautomatically exits when a child process receives a signal
The process above
Linux daemon and linuxdaemon
The daemon startup and management methods can be divided:
1. stand alone that can be started independently;
2. super daemon for centralized management of services.
Daemon-related files and some important configuration files are basically stored
Daemon Overview
Daemon, also called daemon process (somehow, I suddenly remembered the vampire Diary of Damon, very good-looking American drama), Linux in the background service process. He is a long-running process that is usually independent of the control terminal and periodically performs a task or waits to handle
This article describes the startup scripts of various services in the/etc/rc. d/init. d directory after rhel 5.1 is installed by default.Acpid: ACPI advanced configuration and Power Management InterfaceAnacron: a scheduling tool in Linux, similar to cron. You can disable it unless necessary.Apmd: apm advanced power management. If acpid is enabled, apmd does not need to be enabled. ACPI can be disabled instead of apmd.Atd: a service that supports at co
The php daemon and the linux command nohup are used to execute the task once per second. In Unix, the nohup command function means to run the command without hanging up, while nohup puts all the output of the program to the current directory nohup. in the out file, if the file cannot be written, the nohup command function in the user's main Unix is to run the command without hanging up, and nohup puts all t
Article Title: Daemon in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
When you see this word, you will first think of the commonly used software virtual Optical Drive. In
:
# Chmod + x/php_scripts/scan_userstatus.php
# Nohup/php_scripts/scan_userstatus.php
Here, we run the script in the background through . To prevent the process from being killed as the terminal session window closes, we use the nohup command. Is there a way to run the nohup command, just like the Unin/Linux Daemon command. Next we will talk about the daemon
memory resources were not released and new scripts were enabled. That is: The new script is started, and the resources used by the old script are not released as intended. So, over time, a lot of wasted memory resources. We have made some improvements to this script, as follows:
@file:/php_scripts/scan_userstatus.php
Copy CodeThe code is as follows:
#/usr/bin/env Php-q
while (1) {
$status = Has_goaway ();
if ($status) {
Done
}
Usleep (10000000);
}
?>
This way, there is no need
as the terminal session window closes, we use the nohup command. Is there a way to run the nohup command, just like the Unin/Linux Daemon command. Next we will talk about the daemon functions.
What is a daemon? A Daemon is often regarded as a background task that does not
memory resources were not released and new scripts were enabled. That is: The new script is started, and the resources used by the old script are not released as intended. So, over time, a lot of wasted memory resources. We have made some improvements to this script, as follows:
@file:/php_scripts/scan_userstatus.php
Copy CodeThe code is as follows:
#/usr/bin/env Php-q
while (1) {
$status = Has_goaway ();
if ($status) {
Done
}
Usleep (10000000);
}
?>
This way, there is no need
Linux system services run on daemon. They are mainly divided into two categories:
1) standalone: You can start services independently, such as httpd and vsftpd. It features fast response, but high resource usage.
2) super daemon: A special unified management of daemon. When the client does not have a request, the servi
/xinetd.conf,/etc/xinetd.d/*: Super daemon config fileSuper Daemon's main profile (which is actually the default) is/etc/xinetd.conf, but as we mentioned above, Super Daemon is just a unified management mechanism, and other daemon configurations he manages are written in/etc/xinetd.d /* Inside Oh!/etc/*: Individual configuration files for each service/var/lib/*:
improvements to this script, and the improvements are as follows:
@file:/php_scripts/scan_userstatus.php
Copy CodeThe code is as follows:
#/usr/bin/env Php-q
while (1) {
$status = Has_goaway ();
if ($status) {
Done
}
Usleep (10000000);
}
?>
In this way, no need for crontab. The script can be executed with the following command to achieve the same functional effect
#chmod +x/php_scripts/scan_userstatus.php
#nohup/php_scripts/scan_userstatus.php
Here, we run the script through , and we use th
creation mask * /
return;
}
int main ()
{
FILE *FP;
Signal (SIGCHLD, sig_ign); / * Ignore child process end signal to prevent zombie process * /
Init_daemon ();
While (1)
{
Sleep (1);
if (fp = fopen ("/home/mantou/test.log", "a"))! = NULL)
{
fprintf (FP, "%s\n", "test message");
Fclose (FP);
}
}
return 0;
}
Add:(1) About process struct RLIMIT structure click to open linkIn Linux systems, resouce limit ref
Dialog with the Linux kernel daemon AndrewMorton-Linux general technology-Linux programming and kernel information. The following is a detailed description. HOST: Thank you, Jonathan Corbet. Next we will ask Andrew Morton, the guardian of Linux kernel 2.6, to have a conversa
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.