openwrt 为软件包添加服务
手动修改 rc.local 加入也可以实现自启动,缺点手动修改太麻烦,停止只能用 kill 。
配置成服务最方便了,可以启用或禁用,启动,停止,重启非常方便。
在openwrt 中使用服务 service 是非常方便的。
define Package/gmediarender/postinst
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
echo "Enabling rc.d symlink for gmediarender"
/etc/init.d/gmediarender enable
fi
exit
endef define Package/gmediarender/prerm
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
echo "Removing rc.d symlink for gmediarender"
/etc/init.d/gmediarender disable
fi
exit
endef
在 gmediarender 的 Makefile 中添加2个项目。 okpg 基于 Debian 的软件包管理方式。postinst 安装以后执行,prerm 移除时执行,还有别的,这里用不到, 不介绍。
define Package/gmediarender/install
$(INSTALL_DIR) $()/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gmediarender $()/usr/bin
$(INSTALL_DIR) $()/etc/init.d
$(INSTALL_BIN) ./files/gmediarender.init $()/etc/init.d/gmediarender #添加服务脚本
$(INSTALL_DIR) $()/usr/share/gmediarender/
$(INSTALL_DATA) ./files/*.png $(1)/usr/share/gmediarender/
endef
gmediarender.init
#!/bin/sh /etc/rc.common
# Copyright (C) - OpenWrt.org START=
APP=gmediarender
SERVICE_WRITE_PID=
SERVICE_DAEMONIZE= start() {
service_start /usr/bin/$APP
} stop() {
service_stop /usr/bin/$APP
}
的确非常简单。
/etc/init.d/gmediarender enable
/etc/init.d/gmediarender disable
/etc/init.d/gmediarender start
/etc/init.d/gmediarender stop
/etc/init.d/gmediarender restart
openwrt 为软件包添加服务的更多相关文章
- Cloudera Manager安装之利用parcels方式安装单节点集群(包含最新稳定版本或指定版本的安装)(添加服务)(CentOS6.5)(四)
不多说,直接上干货! 福利 => 每天都推送 欢迎大家,关注微信扫码并加入我的4个微信公众号: 大数据躺过的坑 Java从入门到架构师 人工智能躺过的坑 ...
- ASP.NET 5系列教程 (四):向视图中添加服务和发布应用到公有云
向视图中添加服务 现在,ASP.NET MVC 6 支持注入类到视图中,和VC类不同的是,对类是公开的.非嵌套或非抽象并没有限制.在这个例子中,我们创建了一个简单的类,用于统计代办事件.已完成事件和平 ...
- 添加web引用和添加服务引用有什么区别?
添加web引用和添加服务引用有什么区别,Add Service References 和 Add Web References 有啥区别?参考 http://social.microsoft.com/ ...
- Xamarin.Forms项目无法添加服务引用
Xamarin.Forms项目无法添加服务引用 创建的Xamarin.Forms项目中,右击“引用”选项,在弹出的菜单中没有“添加服务引用”命令.这是由于该项目是支持Windows Phone 8.1 ...
- Centos搭建nginx环境,编译,添加服务,开机启动。
首先安装所需的安装库,yum -y install gcc gcc-c++ autoconf libtool* openssl openssl-devel 编译的时候,若有提示错误,提示缺少某个库,y ...
- WCF 在VS中,添加服务引用,地址输入http://ip/Service.svc,点击前往,提示错误,内容如下:
WCF的service端的webconfig如下: <?xml version="1.0"?> <configuration> <system.ser ...
- Linux下chkconfig命令详解即添加服务以及两种方式启动关闭系统服务
The command chkconfig is no longer available in Ubuntu.The equivalent command to chkconfig is update ...
- (转)添加服务引用和添加Web引用对比
在WindowsForm程序中添加服务引用和Web引用对比 为了验证书上有关Visual Studio 2010添加服务引用和Web引用的区别,进行实验. 一.建立一个Web服务程序项目新建项目,选择 ...
- (转)2.4.1 基础知识--添加服务引用与Web引用的区别
<Web服务开发学习实录>第2章构建ASP.NET Web服务,本章我们将学习创建Web服务的各种方法,并重点对使用Visual Studio创建ASP.NET Web服务和修改Web服务 ...
随机推荐
- [LC] 96. Unique Binary Search Trees
Given n, how many structurally unique BST's (binary search trees) that store values 1 ... n? Example ...
- http接口与webservice接口的区别
常见的API接口有两类:http接口和webservice接口. http接口走http协议,通过路径来区分调用方法,请求报文一般是key-value形式的,返回报文一般是json串,常用的是get和 ...
- Python与数据库
链接汇总 https://www.cnblogs.com/stacklike/category/1134822.html Python与数据库[1] -> 数据库接口/DB-API[0] -&g ...
- Hashtable和Hashmap的区别?
1.实现的继承的父类不同 Hashtable继承Dictionary类 HashMap继承abstractMap类 两个类都实现了Map接口 2.线程安全性不同 Hashmap线程是不安全的 H ...
- mongoDB连接信息及生成对应的collection生成代码
.net,个人封装MONGODDB的操作. using System; using System.Collections.Generic; using System.Linq; using Syste ...
- rancher1.6高可用集群搭建
rancher高可用集群搭建 一.搭建环境 1.安装系统 下载centos最新版, http://mirrors.sohu.com/centos/7/isos/x86_64/CentOS-7-x86_ ...
- 正负小数js正则表达式
var reg = /^(([1-9]\d+(.[0-9]{1,4})?|\d(.[0-9]{1,4})?)|([-]([1-9]\d+(.[0-9]{1,4})?|\d(.[0-9]{1,4})?) ...
- linux系统加固方案
Linux主机操作系统加固规范 目 录 第1章 概述... 1 1.1 目的... 1 1.2 适用范围... 1 1.3 适用版本... 1 1 ...
- DocumentFragment的相关用法
额,今天看了vue1.0关于模板渲染的知识,认识了DocumentFragment这个东西,它相当于一个节点容器,我们对他使用appendChild时,只有它的子节点会被插入进去,它本身不会插入进去, ...
- iOS中如何实现准确的倒计时程序 · 九十里
iOS中倒计时程序,考虑线程暂停场景. iOS App进入后台时,GCD线程也会跟着暂停.当程序进入前台后,GCD线程恢复.因而倒计时程序需要考虑这一点,通过加入时间的比对来实现. + (void)c ...