linux系统添加程序,Linux添加系统服务小程序

如何增加一个服务:

1.服务脚本必须存放在/etc/ini.d/目录下;

2.chkconfig --add servicename

在chkconfig工具服务列表中增加此服务,此时服务会被在/etc/rc.d/rcN.d中赋予K/S入口了;

3.chkconfig --level 35 mysqld on

修改服务的默认启动等级。

4 启动停止

service servicename start

service servicename stop

Linux 开机启动项目

http://www.ruanyifeng.com/blog/2013/08/linux_boot_process.html

1 在/usr/bin 目录下添加hello.sh 文件 echo "hello"

2 添加到/etc/rc.d/init.d/文件夹之下 文件名sayhello

### BEGIN INIT INFO

# Provides: scriptname

# Required-Start: $remote_fs $syslog

# Required-Stop: $remote_fs $syslog

# Default-Start: 3 5

# Default-Stop: 0 1 6

# Short-Description: Start daemon at boot time

# Description: Enable service provided by daemon.

### END INIT INFO

#!/bin/bash

/usr/bin/hello.sh

3 chmod 777 /usr/bin/hello.sh

chmod 777 /etc/rc.d/init.d/sayhello

4

chkconfig --add sayhello

chkconfig --level 35 sayhello on

5 在rc5.d做一个相应的软连接 ln -s /etc/rc.d/init.d/sayhello /etc/rc5.d/Ssayhello@  ============================================================

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值