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@ ?============================================================
總結
以上是生活随笔為你收集整理的linux系统添加程序,Linux添加系统服务小程序的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux挂载硬盘读写,mount 挂载
- 下一篇: linux 设备文件分区命令,Linux