(1)触发器(Triggers) 触发器是一个字符串,用于匹配特定的事件,这些事件将触发触发器所属动作(Actions)的执行。 触发器 说明 boot This is the first trigger that occurs when init starts (after /init.conf is loaded). = Triggers of this form occur when the property is set to the specific value . device-added- device-removed- Triggers of these forms occur when a device node is added or removed. service-exited- Triggers of this form occur when the specified service exits.
(2)指令(Commands) Command Description exec [ ]* Fork and execute a program ( ). This will block until the program completes execution. Try to avoid exec. Unlike the builtin commands, it runs the risk of getting init "stuck". export Set the environment variable equal to in the global environment (which will be inherited by all processes started after this command is executed). ifup Bring the network interface online. import Parse an init config file, extending the current configuration. hostname Set the host name. class_start Start all services of the specified class if they are not already running. class_stop Stop all services of the specified class if they are currently running. domainname Set the domain name. insmod Install the module at . mkdir Make a directory at . mount [ ]* Attempt to mount the named device at the directory . This may be of the form mtd@name to specify a mtd block device by name. setkey - currenlty undefined - setprop Set system property to . setrlimit Set the rlimit for a resource. start Start a service running if it is not already running. stop Stop a service from running if it is currently running. symlink Create a symbolic link at with the value . write [ ]* Open the file at and write one or more strings to it with write(2).
服务(Services) 服务是初始化程序需要启动的一些程序,初始化程序还有可能会在这些程序退出之后重启它们。Services take 一个服务定义的形式如下: service [ ]*