编辑脚本
本例以添加svnserve为例
#!/bin/sh#echo $1START='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 informationupdate-rc.d: see <http://wiki.debian.org/LSBInit s> 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/svnserve20代表启动顺序,这个数值越大,则越后启动
至此,下次重启电脑就会自动执行该脚本命令
立即启动服务
service svnserve start其他命令
service svnserve stop
service svnserve restart
继续阅读与本文标签相同的文章
上一篇 :
SSH免登录设置
下一篇 :
Mysql 笔记--分页优化
-
Phantomjs截图乱码
2026-06-02栏目: 教程
-
RMI执行过程分析
2026-06-02栏目: 教程
-
Ubuntu下Wireshark普通权限不足之解决方案
2026-06-02栏目: 教程
-
Epoll vs Poll vs Select
2026-06-02栏目: 教程
-
Linux中select poll和epoll的区别
2026-06-02栏目: 教程
