Android initialization language

Android initialization language

Android initialization Language (Android Init Language) for writing Android process startup scripts
include four types of statements: Action, Command, Service, Option .

A .Action

1 Overview

Action Command is a sequence. Action has a trigger, which is used to determine the execution time of the Action. When a trigger condition is consistent with Action event, Action will be added to the end of the implementation of the queue, unless it is already in the queue. Action each queue are sequentially extracted, and each of the Action Command will be sequentially executed.

2. syntax

on <trigger>
     <command>
      <command>
      <command>

3.trigger

It is a trigger event for the particular type of string matching, for Action occur.
1) .boot
This is the first execution after the init triggered trigger.
2). <Name> = <
value> This form will be set to trigger when the trigger is specified in the attribute.
3) .device-added- <path>
This form would be triggered when a trigger device node file is added.
4) .device-removed- <path>
This form of trigger fires when a file is deleted device node.
5) .service-exited- <name>
This type of trigger is triggered when a specific service exit.

Two .Service

1 Overview

Service is a program that at the time of initial startup and on exit restart (optional).

2. syntax

service <name> <pathname> [ <argument> ]*
             <option>
             <option>
             …

Three .Option

1 Overview

Option is amended Service. Service and they affect how and when to run.

2. syntax

1) .critical
Description This is a service for critical equipment. If it is greater than four times to exit within four minutes, the system will reboot into recovery (recovery) mode.
2) .disabled
Description This service is not the same and it starts automatically with the service under the trigger. He must be explicitly started by name.
3) .setenv <name> <value
> when the process started the environment variable <name> is set to <value>.
4) .socket <name> <type
> <perm> [<user> [<group>]] creates a domain Uinx named / dev / socket / <name> socket, and passes it to a file descriptor to the process has started. <type> must be "dgram" or "stream". User and group defaults to 0.
5) .user <username>
to change the service before starting the service user name. At this time, the default is root.
6) .group <GROUPNAME> [<GROUPNAME>] *
to change the group name of the service before starting the service. In addition to (Required) The first group name, the group name is typically added to supplement the group setting process.
7) .oneshot
not restart when the service exits.
8) .class <name>
Specifies the class name of a service. All the same class service names may start and stop at the same time. If you do not specify a class by class name option, the default class named "default" .
9) .onrestart
when the service restarts, execute a command.

Four .Command

1 Overview

For executing an instruction

2. syntax

. 1) .exec <path> [<argument>] *
creating and executing a program (<path>). Before the program is fully executed, init will be blocked. Since it is not built-in command, should try to avoid using exec, it may cause init stuck.
2) .export <name> <value
> in the global environment variables provided in the environment variable <name> as <value>. (Which will be inherited by all processes running after this command)
3) .ifup <interface>
to start the network interface <interface>
4) .import <filename>
parses a configuration file init, extending the current configuration.
5) .hostname <name>
set the host name.
6) .chmod <octal-mode>
<path> change file access permissions.
7) .chown <owner> <group
> <path> change the owner and group files.
8) .class_start <serviceclass>
start running the service is not specified in all service classes.
9) .class_stop <serviceclass>
stop all services running under the specified service class.
10) .domainname <name>
Set the domain name.
11).

12) .mkdir <path> [mode
] [owner] [group] Create a directory <path>, may be selectively designated mode, owner, and group. If not specified, the default permissions to 755, and belongs to the root user and root group.
13) .mount <of the type> <Device> <dir> [<mountoption>] *
attempt in the directory <dir> to mount the specified device. <device> be in the form mtd @ name specifies a mtd block device. <mountoption> include "RO", "RW", "the remount", "the noatime", ...
14) .setprop <name> <value>
Set System Properties <name> as <value> values.
15) .setrlimit <Resource> <cur> <max>
settings <resource> is of rlimit (resource constraints).
16) .start <service>
to start the specified service (if this service is not already running).
17) .stop <service>
Stop the specified service (if this service is in operation).
18) .symlink <target> <path
> create a link <path> flexible connection <target>.
19) .sysclktz <


A trigger event. Action action for an arrangement with one another.
21 is) .write <path> <String> [<String>] *
open path <path> of a file, and writing one or more strings.

V. View the currently executing instruction

Init update some system properties to provide the ability to monitor what is happening, you can view the Android system instruction currently being executed by these attributes.
1.init.action
Action is the name of this attribute value is being executed, if none '. "
2.init.command
name of the command of this property is being executed, if none '. "
3.init.svc. <Name>
This attribute is named <name> is the state of service ( "stopped" (stop), "running" (run), "restarting" (restart))

Published 10 original articles · won praise 5 · Views 582

Guess you like

Origin blog.csdn.net/LeeDuoZuiShuai/article/details/103998595