Linux program self-starting and new Linux service methods

Source: Internet
Author: User
Tags ldap syslog system log time and date usleep openssh server rsync

1 Linux creating a self-starter program
Both of the self-initiated methods have been tested by themselves.
1.1 Self-Starting program Method 1:
In etc/rc.local add/home/robin/code/autoruntest >/dev/null & (where Autoruntest test program name, hereinafter). Can be self-booting
1.2 Self-Starting program Method 2:
To create a Linux service, proceed as follows:
1) Write service startup script file (attached example)
2) Modify the script file chmod 777 Autoruntest
3) Copy the script file to/etc/rc.d/init.d/
4) chkconfig--add autoruntest Add service
5) reboot (complete)
After the third step, you can use service start to stop, you must use Chkconfig to add the services to the system from start.
2 Services in Linux
To customize the system service, you must operate as root user. Through the NTSYSV command you can see all the services of the system, and whether it is started with the system, where you can customize the system services, the interface as shown here, you can see that the test program Autoruntest has been added as system services, and is running with the system. You can customize the start-up service here, and press F1 to see a description of each service. Introduction to the system services.


3 Appendices
3.1 Examples of service script files
#!/bin/bash
#
# Autoruntest The shell script takes care of Autoruntest auto start and stop
#
# chkconfig:2345 20 80
# Description:autoruntest
# ProcessName:/etc/rc.d/init.d/autoruntest

Exec_path=/home/robin/code
Exec=autoruntest
Pid_file=/var/run/autoruntest.pid
Daemon=/home/robin/code/autoruntest

# Source function library.
. /etc/rc.d/init.d/functions

if! [-X $EXEC _path/$EXEC]; Then
echo "ERROR: $EXEC _path/$EXEC not Found"
Exit 1
Fi

Stop ()
{
echo "stoping $EXEC ..."
Killall $DAEMON >/dev/null
Usleep 100
echo "Shutting down $EXEC: [OK]"
}

Start ()
{
echo "Starting $EXEC ..."
$DAEMON >/dev/null &
Usleep 100
echo "Starting $EXEC: [OK]"
}

Restart ()
{
Stop
Start
}


Case "$" in
Start
Start
;;
Stop
Stop
;;
Restart
Restart
;;
Status
Status-p $PID _file $DAEMON
;;
*)
echo "Usage:service $EXEC {start|stop|restart|status}"
Exit 1
Esac

Exit $?

3.2 Introduction to System services
1. Alsasound:alsa sound card driver daemon.
2. Acpid:acpid (Advanced Configuration and Power Interface) is a new power management standard that has been introduced to replace traditional APM power management standards. Usually laptops need to be powered up for management.
3. Atalk:appletalk the network daemon.
4. AMD: Automatically installs the NFS daemon.
5. Anacron: An automated running task daemon.
6. APMD:APMD (Advanced Power Management) is a premium management.
7. ARPTABLES_JF: Control the filtering daemon for users of the Arptables network.
8. Arpwatch: Log and build an Ethernet address and IP address pair database that you see on the LAN interface.
9. AutoFS: Automatically installs the management process AutoMount, which is related to NFS and relies on Server for NIS.
BOOTPARAMD: A boot parameter server that provides the information needed to boot a diskless workstation on a LAN.
Bluetooch: Bluetooth server daemon.
Crond:cron is a traditional program under UNIX that periodically runs user-scheduled tasks. Compared to the traditional UNIX version, the Linux version adds a lot of attributes and is more secure and simpler to configure. Similar to Scheduled tasks.
Chargen: The Chargen server,chargen (Character Generator Protocol) using the TCP protocol is a network service, and the main function is to provide similar remote typing capabilities.
CHARGEN-UDP: Chargen server using the UDP protocol.
Cpuspeed: Monitors system idle percentages, reduces or accelerates CPU clock speed and voltage to minimize energy consumption when the system is idle, and maximizes system execution speed when the system is busy.
DHCPD: The service daemon for Dynamic Host Control Protocol (PROTOCOL).
Cups:cups (Common Unix Printing System) is a generic UNIX print daemon.
Cups-config-daemons:cups Print System Switch daemon.
The Cups-lpd:cups line Print daemon.
Daytime: The daytime daemon using the TCP protocol, which provides the client with the ability to obtain the date and time from a remote server. Default port: 13.
DAYTIME-UDP: The daytime daemon using the UDP protocol.
Dc_server: Proxy Server daemon using SSL Secure sockets.
Dc_client: The client daemon that uses SSL Secure sockets.
Diskdump: Server disk Backup daemon.
Echo: The server echoes the Customer data Service daemon.
ECHO-UDP: The server that uses the UDP protocol echoes the client data Service daemon.
Eklogin: A daemon that accepts rlogin session forensics and a service that is encrypted with KERBEROS5.
Gated: Gateway routing daemon. It supports a variety of routing protocols, including RIP versions 1 and 2, the DCN Hello Protocol, OSPF version 2, and EGP versions 2 through 4.
GPM:GPM (General Purpose Mouse Daemon) daemon provides mouse support for Linux programs in text mode such as MC (Midnight Commander).
GSSFTP: FTP daemon with Kerberos 5 authentication
Httpd:web Server Apache daemon.
inetd: Internet Operation daemon.
Innd:usenet News server Daemon.
Iiim: Chinese Input Method Server daemon.
Iptables:iptables Firewall daemon.
The. IrDA: Infrared Port daemon.
ISDN:ISDN starts and aborts the service daemon.
Krb5-telnet: The telnet daemon that uses Kerberos 5 authentication.
Klogin: remote login daemon.
Keytable: The function of this process is to reprint the keyboard mapping table defined in/etc/sysconfig/keyboards, which can be selected through the Kbdconfig tool. You should make the program active.
Irqbalance: A daemon that load balances system interrupt requests in multiple system processor environments. If you have only one CPU installed, you do not need to load this daemon.
Kshell:kshell daemon process.
Kudzu: Hardware auto-detection program.
The Directory Access Protocol server daemon for LDAP:LDAP (Lightweight Directory Access Protocol).
Lm_seroems: Detects the motherboard work daemon.
LPD:LPD is an old-fashioned print daemon responsible for submitting programs such as LPR to print jobs.
Mdmonitor:raid. Daemon for related devices.
Messagebus:d-bus is a library that provides one-to-two communication for two or more two applications.
Microcode_ctl: Can encode and send new micro-codes to the kernel to update the Intel IA32 series processors.
Mysqld: A fast and efficient and reliable lightweight SQL database engine daemon.
The Named:dns (BIND) server daemon.
NETPLUGD:NETPLUGD (Network cable hotplug Management daemon) daemon, which monitors the state of one or more network interfaces and runs an external script program when certain events are triggered.
Netdump: Remote network backup server daemon.
Netfs:network Filesystem Mounter, the process installs and uninstalls NFS, samba, and NCP network file systems.
NFS: Network File System daemon.
Nfslock:nfs is a popular protocol for sharing files over a TCP/IP network, and this daemon provides the NFS file locking feature.
Ntpd:network Time Protocol Daemon (Network Temporal Correction Protocol). NTPD is the protocol daemon used to keep the system and an accurate time source in sync with time.
NET: Activates/shuts down the various network interface daemons at startup.
PSACCT: The daemon includes several tools for monitoring process activity, including Ac,lastcomm, Accton, and SA.
PCMCIA: Mainly used to support the laptop interface daemon.
Portmap: This daemon is used to support RPC connections, and RPC is used for services such as NFS and NIS.
Postgresql:postgresql relational database engine.
PROFTPD:PROFTPD is a daemon that configures a flexible FTP server under UNIX.
PPPOE:ADSL Connection daemon.
Random: A high-quality random number generator that saves and restores the system, which is provided by some random behavior of the system.
Rawdevices: The daemon used to load raw devices when using a clustered file system.
ReadAhead, Readahead_early:readahead, and Readahead_early are the latest two daemons running in the background in Fedora Core 2. The function is to start the system, the file to be used to start the system to read into memory, and then execute in memory to speed up the system.
rhnsd:red Hat Network Service daemon. Notify the official security information and patch the system.
Routed: The daemon supports automatic IP routing table maintenance for RIP protocols.
Rsync:remote Sync Remote Data Backup daemon.
RSH: Starts a shell on the remote host and executes the user command.
Rwhod: Allows a remote user to obtain a list of all logged-in users on the machine running the rwho daemon.
RSTATD: A waiting process for collecting and providing system information for other machines on the LAN.
Ruserd: Remote User location service, an RPC-based service that provides user information about the current record to a machine log in the LAN
RWALLD: Activates the Rpc.rwall service process, an RPC-based service that allows users to write messages to each other terminal registered on the LAN machine.
Rwhod: Activates the Rwhod service process, which supports LAN rwho and Ruptime services.
SASLAUTHD: Use the SASL authentication daemon.
SendMail: Mail server sendmail daemon.
Smb:samba File share/Print Service daemon.
SNMPD: Local Simple Network management daemon.
Bayi Squid: Agent server squid daemon.
The SSHD:OPENSSH server daemon. Secure Shell protocol enables remote management of hosts safely.
Smartd:self Monitor Analysis and Reporting technology System monitors your hard drive for failure.
Syslog: A script that lets the system boot up the syslog and klogd the system log waiting process.
Time: The daemon obtains the times and dates from the remote host, using the TCP protocol.
TIME-UDP: The daemon obtains the time and date from the remote host, using the UDP protocol.
Tux: The daemon that runs the Apache server in the Linux kernel.
The daemon of the VSFTPD:VSFTPD server.
VNCSERVER:VNC (Virtual network Computing, VM Compute).
xfs:x Window Font Server daemon that provides font sets for local and remote X servers.
XINETD: A core daemon that supports multiple network services.
Ypbind: Activates the Ypbind service process for NIS (Network Information System) clients.
The Yppasswdd:nis Password Server daemon.
94. Ypserv:nis Master Server daemon.
YUM:RPM operating system auto-upgrade and package management daemon.

According to their own needs to feel whether to start a department service. such as: U, iptables, etc. are necessary to run. Echo, ECHO-UDP, daytime, DAYTIME-UDP, Chargen, CHARGEN-UDP can be turned off. Rsh, RSTATD, rsync, RUSERSD, rwalld These commands are Berkley remote commands, because they all start with the letter R, so they are called the r* command. The main use is to make a user on a computer with the same account remote execution of another computer program, do not shut down, reduce the risk. Innd is the process that runs the newsgroup service and should not be closed.

Linux program self-starting and new Linux service methods

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.