linux安装脚本
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
#!/bin/bash
# user can config the following configs, then package.
INSTALL=/usr/local/cusflo-server
ok_msg() {
echo -e "${1}${POS}${BLACK}[${GREEN} OK ${BLACK}]"
}
failed_msg() {
echo -e "${1}${POS}${BLACK}[${RED}FAILED${BLACK}]"
}
# discover the current work dir, the log and access.
echo "argv[0]=$0"
if [[ ! -f $0 ]]; then
echo "directly execute the scripts on shell.";
work_dir=`pwd`
else
echo "execute scripts in file: $0";
work_dir=`dirname $0`; work_dir=`(cd ${work_dir} && pwd)`
fi
product_dir=$work_dir
# user must stop service first.
ok_msg "check previous install"
if [[ -f /etc/init.d/cusflo-server-moon ]]; then
/etc/init.d/cusflo-server-moon status >/dev/null 2>&1
ret=$?; if [[ 0 -eq ${ret} ]]; then
failed_msg "you must stop the service first: sudo /etc/init.d/cusflo-server-moon stop";
exit 1;
fi
fi
ok_msg "previous install checked"
# backup old srs
ok_msg "backup old cusflo-server-moon"
install_root=$INSTALL
install_bin=$install_root/
if [[ -d $install_root ]]; then
backup_dir=${install_root}.`date "+%Y-%m-%d_%H-%M-%S"`
ok_msg "backup installed dir"
ok_msg " to=$backup_dir"
mv $install_root $backup_dir 2>&1
ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "backup installed dir failed"; exit $ret; fi
ok_msg "backup installed dir success"
fi
ok_msg "old srs backuped"
# copy core files
ok_msg "copy core components"
(
mkdir -p $install_root
cp -r $work_dir/conf $install_root &&
cp -r $work_dir/dog $install_root &&
cp -r $work_dir/log $install_root &&
cp -r $work_dir/moon $install_root &&
cp -r $work_dir/scripts $install_root
) 2>&1
ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "copy core components failed"; exit $ret; fi
ok_msg "copy core components success"
# install init.d scripts
ok_msg "install init.d scripts"
(
rm -rf /etc/init.d/cusflo-server-moon &&
ln -sf $install_root/scripts/cusflo-server-moon /etc/init.d/cusflo-server-moon
) 2>&1
ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "install init.d scripts failed"; exit $ret; fi
ok_msg "install init.d scripts success"
# install system service
lsb_release --id|grep "CentOS" >/dev/null 2>&1; os_id_centos=$?
lsb_release --id|grep "Ubuntu" >/dev/null 2>&1; os_id_ubuntu=$?
lsb_release --id|grep "Debian" >/dev/null 2>&1; os_id_debian=$?
lsb_release --id|grep "Raspbian" >/dev/null 2>&1; os_id_rasabian=$?
if [[ 0 -eq $os_id_centos ]]; then
ok_msg "install system service for CentOS"
/sbin/chkconfig --add cusflo-server-moon && /sbin/chkconfig cusflo-server-moon on
ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "install system service failed"; exit $ret; fi
ok_msg "install system service success"
elif [[ 0 -eq $os_id_ubuntu ]]; then
ok_msg "install system service for Ubuntu"
update-rc.d cusflo-server-moon defaults
ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "install system service failed"; exit $ret; fi
ok_msg "install system service success"
elif [[ 0 -eq $os_id_debian ]]; then
ok_msg "install system service for Debian"
update-rc.d cusflo-server-moon defaults
ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "install system service failed"; exit $ret; fi
ok_msg "install system service success"
elif [[ 0 -eq $os_id_rasabian ]]; then
ok_msg "install system service for RaspberryPi"
update-rc.d cusflo-server-moon defaults
ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "install system service failed"; exit $ret; fi
ok_msg "install system service success"
else
warn_msg "ignore and donot install system service for `lsb_release --id|awk '{print $3}'`."
fi
echo ""
echo "install success, you can:"
echo -e "${GREEN} sudo ./moon/scripts/cusflo-server-moon start${BLACK}"
echo "cusflo-server-moon root is ${INSTALL}"
exit 0
|
linux安装脚本的更多相关文章
- Linux安装脚本需要交互之如何实现自动安装
Linux中shell脚本运行时经常需要进行交互,比如安装软件的过程中对license声明的确认,需要输入yes,回车之类的确认信息.这个在自动化安装的时候就会是个问题. 通常对于这个问题比较灵活的解 ...
- Linux环境下JDK/Eclipse一键安装脚本
-------------------------------------------------------------------- author:jiangxin Email:jiangxinn ...
- Odoo Linux服务器一键安装脚本使用指南
Odoo安装脚本介绍 为了帮助更多Linux服务器维护人员快速部署Odoo,为此开源智造(OSCG)基于André Schenkels曾经开放的openerp-install-scripts所构建的基 ...
- 树莓派进阶之路 (035) - 基于linux的zsh安装脚本
基于linux的zsh安装脚本: Ubuntu版本: #!/bin/sh cd #安装zsh sudo apt-get install zsh #查看zsh cat /etc/shells #更改zs ...
- MySQL For Linux(CentOS/Ubuntu/Debian/Fedora/Arch)一键安装脚本(5.1-8.0)
简介 很多童鞋不懂这么在Linux系统安装MySQL,网上大多数教程较复杂,不太适合小白安装,本教程提供一键安装脚本供大家使用,教大家怎么在Linux操作系统( 支持CentOS/Ubuntu/Deb ...
- jdk1.8一键安装脚本(linux环境)
1.下载jdk安装包和安装脚本 下载地址:https://pan.baidu.com/s/1bo6ADQ3 其中包括: jdk安装包:jdk-8u151-linux-x64.tar.gz jdk一键安 ...
- linux 安装配置kafka脚本
安装脚本 #!/bin/bash # auto install kafka echo "========= Start to install kafka ==============&quo ...
- [linux] shell脚本编程-xunsearch安装脚本学习
安装脚本setup.sh #!/bin/sh # FULL fast install/upgrade script # See help message via `--help' # $Id$ # s ...
- centos7 lvm合并分区脚本初探-linux性能测试 -centos7修改网卡名字-jdk环境安装脚本-关键字查询文件-批量添加用户
1.#!/bin/bash lvmdiskscan | grep centos > /root/a.txt a=`sed -n '1p' /root/a.txt` b=`sed -n '2p' ...
随机推荐
- [React] Test friendly approach
Add functional function such as change state, this should have tests covered. For example, in a comp ...
- 【codeforces 546B】Soldier and Badges
time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- Oracle数据库中的几个名字及监听的配置问题
学习数据库的时候,由于数据库只建了一个库,而且只是本机访问,所以没有对listener.ora与tnsname.ora这两个文件进行过多设置,但是实际中要区分客户端与服务器端,相互之间的访问就存在微妙 ...
- WPF入门(三)->几何图形之不规则图形(PathGeometry)
原文:WPF入门(三)->几何图形之不规则图形(PathGeometry) 前面我们给大家介绍了LineGeometry,EllipseGeometry,CombinedGeometry等一些规 ...
- 【codeforces 776D】The Door Problem
[题目链接]:http://codeforces.com/contest/776/problem/D [题意] 每个门严格由两个开关控制; 按一下开关,这个开关所控制的门都会改变状态; 问你能不能使所 ...
- webpack run dev后并没有生成dist目录,但是浏览器里却读取了dist里的build.js?
最近想看看现在做的React项目用的脚手架,看了下webpack的配置,尝试修改一些东西看看输出结果,结果允许npm run dev发现没有输出目录,怎么回事呢.又安装了vue官方提供的webpack ...
- Less小总结
= 导航 顶部 变量 混合 继承 函数 顶部 变量 混合 继承 函数 Less 是一个Css 预编译器,意思指的是它可以扩展Css语言,添加功能如允许变量(variables),混合(mi ...
- axios 提交 application/x-www-form-urlencoded
最近工作比较忙 , 喜欢上了用有道云做笔记 , 写博客就是为了记录自己的学习的点点滴滴 , 如果能对其他人有帮助当然最好了 , 我一定要将这个习惯进行下去 .. ..... 我们以前的前后交互方式一般 ...
- [Scikit-Learn] - 数据预处理 - 缺失值(Missing Value)处理
reference : http://www.cnblogs.com/chaosimple/p/4153158.html 关于缺失值(missing value)的处理 在sklearn的prepro ...
- Mybatis使用TypeHandler实现数据的加解密转换
参考: MyBatis之TypeHandler: https://www.cnblogs.com/yulinfeng/p/5991170.html 前段时间收到这么个需求:为安全起见,要求在数据库 ...