当前位置: 首页 > news >正文

昆明做网站建设技巧公司网络视频营销的案例

昆明做网站建设技巧公司,网络视频营销的案例,郴州网站推广公司排名,个人网站要多少钱#expect脚本在自动化部署中的具体应用 expect脚本是一个非常好的交互式应用脚本,在自动化部署中,可以使用这个脚本来实现全自动的自动化部署。下面是一些具体的应用案例。 场景一:自动安装mysql 可以使用expect脚本来实现mysql自动安装&…

#expect脚本在自动化部署中的具体应用
expect脚本是一个非常好的交互式应用脚本,在自动化部署中,可以使用这个脚本来实现全自动的自动化部署。下面是一些具体的应用案例。

场景一:自动安装mysql

可以使用expect脚本来实现mysql自动安装,提取初始化密码,并使用初始化密码登录系统,然后修改密码,再执行数据库初始化操作。

send "unzip mysql.zip\n"
expect "# "
send "rpm -ivh libaio-0.3.109-13.el7.x86_64.rpm\n"
sleep 10
expect "]# "
send "rpm -ivh numactl-2.0.7-8.el6.x86_64.rpm\n"
sleep 10
expect "]# "
send "tar -zxvf  mysql-5.7.42-linux-glibc2.12-x86_64.tar.gz -C /usr/local\n"
sleep 60
expect "]# "
send "mv /usr/local/mysql-5.7.42-linux-glibc2.12-x86_64 /usr/local/mysql\n"
sleep 3
expect "# "
send "groupadd mysql\n"
expect "# "
send "useradd -g mysql -s /bin/false mysql\n"
expect "# "
send "mkdir -p /data/mysql\n"
expect "# "
send "chown -fR mysql:mysql /data/mysql\n"
expect "# "
send "cd /usr/local/mysql/bin/\n"
expect "# "
send "./mysqld --defaults-file=/etc/my.cnf --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql\n"
expect "# "
send "ln -s /usr/local/mysql/bin/mysql /usr/sbin/mysql\n"
expect "# "
send "/bin/cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql\n"
expect "# "
send "chmod +x /etc/init.d/mysql\n"
expect "# "
send "cd /etc/rc.d/init.d\n"
expect "# "
send "chkconfig --add mysql\n"
expect "# "
send "chkconfig mysql on\n"
expect "# "
send "/etc/init.d/mysql start\n"
expect "# "
send "cd /data/mysql\n"
expect "# "
send "cat error.log | grep password| awk \"{ print \\\$NF}\"\n"
expect {-re {password is generated for root@localhost: (.+)} {set myPassword \$expect_out(1,string)}timeout {puts "未找到匹配的密码字符串"}
}
expect "# "
puts "MySQL初始密码为:\$myPassword"
send "mysql -uroot -p\n"
expect "password: "
send "\$myPassword\n"
expect "mysql> "
send "set password =password('wahaha@m#T98kjhss');\n"
expect "mysql> "
send "grant all privileges on *.* to 'root'@'%' identified by 'wahaha@m#T98kjhss';\n"
expect "mysql> "
send "flush privileges;\n"
expect "mysql> "
send "create database wahaha;\n"
expect "mysql> "
send "use wahaha;\n"
expect "mysql> "
send "set names utf8;\n"
expect "mysql> "
send "source /opt/mysql/wahaha_mysql.sql;\n"
expect "mysql> "
send "exit\n"
expect "# "

场景2 安装JDK

解压安装JDK,并将JAVA_HOME相关变量写入/etc/profile中。

send "cd /usr/java; tar -zxvf jdk1.8.0_191.tar.gz\n"
expect "# "
send "echo 'JAVA_HOME=\/usr\/java\/jdk1.8.0_191' >> /etc/profile\n"
expect "# "
send "echo 'JRE_HOME=\\\${JAVA_HOME}\/jre' >> /etc/profile\n"
expect "# "
send "echo 'CLASSPATH=.:\\\${JAVA_HOME}\/lib:\\\${JRE_HOME}\/lib' >> /etc/profile\n"
expect "# "
send "echo 'PATH=\\\${JAVA_HOME}\/bin:\\\$PATH' >> /etc/profile\n"
expect "# "
send "echo 'export JAVA_HOME JRE_HOME CLASSPATH PATH' >> /etc/profile\n"
expect "# "
send "source /etc/profile\n"
expect "# "
send "java -version\n"
expect "# "

结论

使用同样的方法,我们可以实现任意安装过程,包括tomcat、redis,kafaka, 甚至Kubernetes。通过expect脚本,一切命令化,皆可自动化。expect与jenkins结合,我们可以实现绝大部分系统的自动化安装部署,这将给系统运维带来极大的便利。

http://www.ds6.com.cn/news/18050.html

相关文章:

  • 找人做app网站网络营销百科
  • 义乌个人兼职做建设网站台州seo优化公司
  • 二建证书查询官网入口郑州seo排名优化公司
  • 成都手机号码销售网站建设百度百度一下你就知道
  • 图片素材网站怎么做怎么做seo
  • 亦庄做网站seo准
  • 公司做免费网站开发网站
  • 基于bbs的网站开发项目报告百度文库官网入口
  • 思明区建设局网站seo排名软件
  • 商丘做网站的哪家好开发app需要多少资金
  • jsp购物网站开发百度推广关键词和创意
  • 网站设计字体最好用推广普通话的意义是什么
  • 网站维护花费线上销售平台有哪些
  • 天津市工程信息建设网怎样优化网站
  • 荣耀手机官网入口泉州百度seo公司
  • 网站开发人员晋升体系aso苹果关键词优化
  • 衡州网站建设seo国际网站平台有哪些
  • wordpress同类软件seo网站排名优化教程
  • 重庆网站建站病毒什么时候才能消失
  • wordpress用户排行宁波seo网站服务
  • 网站栏目设置深圳龙华区大浪社区
  • 吉野家网站谁做的百度seo点击器
  • 怎么样做网站才可以加重权重产品市场营销策划方案
  • 做生意在哪个网站做百度关键词排名qq
  • 常德人大网站百度关键词推广帝搜软件
  • 怎么把网站设置为主页面网站服务器一年的费用
  • 绵阳住房和城乡建设厅官方网站东莞关键词优化软件
  • 自己做网站后台做seo前景怎么样
  • 邯郸做网站推广长春seo排名
  • 用织梦做网站有什么公司会要余姚网站如何进行优化