zoukankan      html  css  js  c++  java
  • am335x system upgrade rootfs custom service using systemd script(十七)

    1      Scope of Document

    systemd 是一个 Linux 系统基础组件的集合,提供了一个系统和服务管理器,运行为 PID 1 并负责启动其它程序。功能包括:支持并行化任务;同时采用 socket 式与 D-Bus 总线式激活服务;按需启动守护进程(daemon);利用 Linux 的 cgroups 监视进程;支持快照和系统恢复;维护挂载点和自动挂载点;各服务间基于依赖关系进行精密控制。systemd 支持 SysV 和 LSB 初始脚本,可以替代 sysvinit。除此之外,功能还包括日志进程、控制基础系统配置,维护登陆用户列表以及系统账户、运行时目录和设置,可以运行容器和虚拟机,可以简单的管理网络配置、网络时间同步、日志转发和名称解析等。

    与多数发行版使用的System V风格init相比,systemd采用了以下新技术: (1) 采用Socket激活式与总线激活式服务,以提高相互依赖的各服务的并行运行性能; (2) 用Cgroups代替PID来追踪进程,以此即使是两次fork之后生成的守护进程也不会脱离systemd的控制。

    1.1     Function Requirement

    Learning systemd script, and write related systemd scirpt , example gps.service/4g.service.

    2      Hardware Overview

    NA

                   

    3      Functional Description

    3.1     Functional Block Diagram

    NA

                        

    4      Demo

    4.1     4g script using systemd

    [Unit]

    Description=IoTP 4G Service (one-shot 4g mode)

    Before=ntpd.service

    [Service]

    Type=oneshot

    ExecStart=

    ExecStart=/bin/4g-lunch

    RemainAfterExit=yes

    [Install]

    WantedBy=multi-user.target

    4.2     Gps script using systemd

    [Unit]

    Description=IoTP GPS Service (one-shot mode)

    Before=ntpd.service

    [Service]

    Type=oneshot

    ExecStart=

    ExecStart=/bin/gps-lunch

    RemainAfterExit=yes

    [Install]

    WantedBy=multi-user.target

    5      Boot log

    Starting IoTP 4G Service (one-shot 4g mode)...

    [  OK  ] Started IoTP 4G Service (one-shot 4g mode).

    Starting IoTP GPS Service (one-shot mode)...

    [  OK  ] Started IoTP GPS Service (one-shot mode).

    Basic command:

    systemctl enable 4g.service

    systemctl disable 4g.service

    systemctl status 4g.service

  • 相关阅读:
    FirewallD 详解
    EventBus源码解析
    详谈 Jquery Ajax 异步处理Json数据.
    jQuery Ajax异步处理Json数据详解
    7款jQuery图片轮播滑动插件
    分享15款为jQuery Mobile定制的插件
    在springmvc中解决FastJson循环引用的问题
    SpringMVC与fastjson整合并同时解决中文乱码问题
    SpringMVC处理ajax请求
    spring mvc 返回json的配置
  • 原文地址:https://www.cnblogs.com/lianghong881018/p/10239756.html
Copyright © 2011-2022 走看看