模仿linux系统启动脚本
2016-05-28 17:02
615 查看
实现代码
#!/bin/bash
. /etc/init.d/functions
function usage()
{
echo "$0 {start|stop|restart}"
}
if [ $# -ne 1 ]
then
echo "ttt"
usage
exit 1
fi
case $1 in
start)
action "start..." /bin/true
;;
*)
usage
;;
esac
存为test_1.sh
[root@test# sh test_1.sh
ttt
test_1.sh {start|stop|restart}
[root@test]# sh test_1.sh start
start... [ OK ]
关键代码是. /etc/init.d/functions 和action "start..." /bin/true,失败则是 action "fail..." /bin/false
#!/bin/bash
. /etc/init.d/functions
function usage()
{
echo "$0 {start|stop|restart}"
}
if [ $# -ne 1 ]
then
echo "ttt"
usage
exit 1
fi
case $1 in
start)
action "start..." /bin/true
;;
*)
usage
;;
esac
存为test_1.sh
[root@test# sh test_1.sh
ttt
test_1.sh {start|stop|restart}
[root@test]# sh test_1.sh start
start... [ OK ]
关键代码是. /etc/init.d/functions 和action "start..." /bin/true,失败则是 action "fail..." /bin/false
相关文章推荐
- linux select()详解(一)-- 使用及注意事项
- 3.3Linux内核的组成
- Linux下,解决LVM分区中unknown device的bug
- linux中There are unfinished transactions remaining
- Win7与CentOS7双系统安装
- 用virtualbox安装CentOS 7
- linux系统下开机启动流程
- Linux下如何用vi编辑和保存文件
- 查看CentOS系统版本是32位的还是64位的
- Systemd 进程管理相关
- cloudstack on centos6.5 笔记
- linux运维人员必会开源运维工具体系
- 服务器之Windows和Linux
- 嵌入式linux init系统(busybox init)
- phantomjs的使用+Java代码+依赖js(兼容Linux和windows版本)
- phantomjs的使用+Java代码+依赖js(兼容Linux和windows版本)
- Java开发必会的Linux命令
- linux mysql操作和配置
- 3.2 Linux 2.6后的内核特点
- linux下jdk安装以及配置