Ubuntu笔记--添加启动脚本
2015-04-02 15:57
148 查看
编辑脚本
本例以添加svnserve为例#!/bin/sh #echo $1 START='svnserve -d -T -r /home/rocky/programs/svnrepo/' PID="`ps aux | grep svnserve\ -d\ -T\ -r\ /home/rocky/programs/svnrepo/ | grep -v grep|awk '{print $2}'`" case $1 in 'start') id=$PID if [ "$id" = "" ];then $START fi echo 'START SVNSERVE [OK]' ;; 'stop') id=$PID if [ "$id" != "" ];then kill $id fi echo 'STOP SVNSERVE [OK]' ;; 'restart') id=$PID if [ "$id" != "" ];then kill $id fi echo 'STOP SVNSERVE [OK]' $START echo 'START SVNSERVE [OK]' ;; '') $START ;; esac
执行update-rc.d命令
把启动脚本保存为svnserve,存放在/etc/init.d/目录下cd /etc/init.d/ update-rc.d svnserve defaults 20 输出如下: update-rc.d: warning: /etc/init.d/svnserve missing LSB information update-rc.d: see <http://wiki.debian.org/LSBInitScripts> Adding system startup for /etc/init.d/svnserve ... /etc/rc0.d/K20svnserve -> ../init.d/svnserve /etc/rc1.d/K20svnserve -> ../init.d/svnserve /etc/rc6.d/K20svnserve -> ../init.d/svnserve /etc/rc2.d/S20svnserve -> ../init.d/svnserve /etc/rc3.d/S20svnserve -> ../init.d/svnserve /etc/rc4.d/S20svnserve -> ../init.d/svnserve /etc/rc5.d/S20svnserve -> ../init.d/svnserve
20代表启动顺序,这个数值越大,则越后启动
至此,下次重启电脑就会自动执行该脚本命令
立即启动服务
service svnserve start
其他命令
service svnserve stopservice svnserve restart
相关文章推荐
- Ubuntu下添加开机启动脚本
- Ubuntu下添加开机启动脚本
- ubuntu和开发板添加启动脚本
- Ubuntu下添加开机启动脚本
- Ubuntu 14.04 添加删除开机启动脚本
- Ubuntu下添加开机启动脚本
- 【转载】Ubuntu下添加开机启动脚本
- [转载]Ubuntu下添加开机启动脚本
- Ubuntu下添加开机启动脚本
- Ubuntu 16.04添加开机启动脚本的方法
- Ubuntu下添加开机启动脚本
- Ubuntu下添加开机启动脚本
- Ubuntu下添加开机启动脚本
- Ubuntu下添加开机启动脚本
- Ubuntu下添加开机启动脚本
- Ubuntu下添加开机启动脚本的方法
- ubuntu启动脚本的一些笔记
- Ubuntu下添加开机启动脚本
- Ubuntu下添加开机启动脚本(转载)
- Ubuntu下添加开机启动脚本