OpenHarmony的init程序、init配置与启动项配置
1. init程序编译完后部署在
/bin/init
2. init程序的启动配置文件为
/system/etc/init.cfg
看一下内容与格式:直达
https://gitee.com/openharmony/startup_init/blob/OpenHarmony-v4.1.1-Release/services/etc/init.cfg
3.init程序的后续启动脚本放置目录为
/system/etc/init/
里面是以 .cfg结尾的文件,我们看一下其中的1个重要启动项配置文件appspawn.cfg:
这个文件在源码中保存在:
./base/startup/appspawn/appspawn.cfg
{
"jobs" : [{
"name" : "service:nwebspawn",
"cmds" : [
"mkdir /mnt/sandbox",
"mkdir /mnt/sandbox/com.ohos.render/ 0711 nwebspawn nwebspawn"
]
}
],
"services" : [{
"name" : "appspawn",
"path" : ["/system/bin/appspawn",
"--process-name com.ohos.appspawn.startup --start-flags daemon --type standard ",
"--sandbox-switch on --bundle-name com.ohos.appspawn.startup --app-operate-type operate ",
"--render-command command --app-launch-type singleton --app-visible true"],
"importance" : -20,
"uid" : "root",
"gid" : ["root"],
"socket" : [{
"name" : "AppSpawn",
"family" : "AF_LOCAL",
"type" : "SOCK_STREAM",
"protocol" : "default",
"permissions" : "0660",
"uid" : "root",
"gid" : "appspawn",
"option" : [
]
},
{
"name" : "NWebSpawn",
"family" : "AF_LOCAL",
"type" : "SOCK_STREAM",
"protocol" : "default",
"permissions" : "0666",
"uid" : "nwebspawn",
"gid" : "nwebspawn",
"option" : [
]
}],
"sandbox" : 0,
"start-mode" : "boot",
"secon" : "u:r:appspawn:s0",
"jobs" : {
"on-start" : "service:nwebspawn"
},
"bootevents" : "bootevent.appspawn.started"
}
]
}