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

装修之家网站60天做网站

装修之家网站,60天做网站,北京南站到北京西站,网络推广营销培训机构想写一些简化管理操作的脚本#xff0c;下面是基础脚本之一#xff0c;对于一个从来没使用过perl脚本的我来说还是有些难度的#xff0c;直接上代码。此脚本用于发送远程MySQL命令并且接收结果#xff0c;功能比较简单#xff0c;后面会渐渐完善。#!/usr/bin/perl use Get…想写一些简化管理操作的脚本下面是基础脚本之一对于一个从来没使用过perl脚本的我来说还是有些难度的直接上代码。此脚本用于发送远程MySQL命令并且接收结果功能比较简单后面会渐渐完善。#!/usr/bin/perl use Getopt::Long;use DBI; Getopt::Long::GetOptions( ‘host|hs‘ \$host, ‘user|us‘ \$user, ‘password|pws‘ \$password, ‘port|ps‘ \$port, ‘command|cs‘ \$command, ‘groupfile|fs‘ \$groupfile, ‘help‘ \$help ); #print help info my $printhq{usage : mysqlcon -h 192.168.0.33 -u root -pw ‘xiaojun‘ -p 3306 -c ‘show global status‘ or mysqlcon -g 2.txt -c ‘select user();‘cat 2.txt:192.168.0.33 root xiaojun 3306192.168.0.34 root xiaojun 3306options:-h database server *-u account name *-pw password for account *-p port for mysqld *-c command to execute *-help print help};podif(!defined($host)){ print page flag set to $page }if(defined($user)){ print user flag set to $user\n ;}if(defined($password)){ print onoff flag set to $password \n;}if(defined($command)){ print help flag set to $command \n;}if(defined($help)){ print $printh}cutsub execute_sql{my $dsn DBI:mysql:databasemysql;host$_[0]:$_[1];my ($dbh,$sth,ary);$dbh DBI-connect($dsn,$_[2],$_[3],{‘RaiseError‘ 1});$sth $dbh-prepare($_[4]);$sth-execute(); while(ary $sth-fetchrow_array()){print join(\t,ary),\n;} $sth-finish; $dbh-disconnect; }#execute_sql($host,$port,$user,$password,$command) ;unless (!defined($help)) { die $printh };if(defined($groupfile)){ unless (defined($command)) { die Wrong usage : No command input .\n $printh }; open(IN,$groupfile); while($line){ my argssplit /\s/,$line; print host:args[0]\ncommand:$command\n******BEGIN\n; execute_sql(args[0],args[3],args[1],args[2],$command) ; print ******END \n\n\n*****************************************************\n\n\n; }}else{unless (defined($host)) { die Wrong usage : No host input .\n $printh };unless (defined($user)) { die Wrong usage : No account input .\n $printh };unless (defined($password)) { die Wrong usage : No password input .\n $printh };unless (defined($port)) { die Wrong usage : No port number input .\n $printh };unless (defined($command)) { die Wrong usage : No command input .\n $printh };execute_sql($host,$port,$user,$password,$command) ;}使用方法[rootcentos511 ~]# ./6.perl -h 192.168.0.33 -u root -pw ‘xiaojun‘ -p 3306 -c ‘select user()‘ ;root192.168.0.33[rootcentos511 ~]# ./6.perl -g 2.txt -c ‘select user()‘ host:192.168.0.33command:select user()******BEGINroot192.168.0.33******END *****************************************************host:192.168.0.33command:select user()******BEGINroot192.168.0.33******END *****************************************************[rootcentos511 ~]# cat 2.txt 192.168.0.33 root xiaojun 3306192.168.0.33 root xiaojun 3306[rootcentos511 ~]# ./6.perl -helpusage : mysqlcon -h 192.168.0.33 -u root -pw ‘xiaojun‘ -p 3306 -c ‘show global status‘ or mysqlcon -g 2.txt -c ‘select user();‘cat 2.txt:192.168.0.33 root xiaojun 3306192.168.0.34 root xiaojun 3306options:-h database server *-u account name *-pw password for account *-p port for mysqld *-c command to execute *-help print help
http://www.pierceye.com/news/895858/

相关文章:

  • 商标设计网页seo外包公司兴田德润官方地址
  • 网站开发人员岗位成功营销案例分享
  • 赤峰做网站的公司湘潭哪里做网站
  • 免费自助建站郑州官网seo费用
  • 称心的常州网站建设wordpress怎么用两个主题
  • 建设银行北京分行网站做视频网站用什么服务器配置
  • 网站备案流程实名认证医疗网站建设资讯
  • 一个做问卷调查的网站好wordpress七比2
  • 西双版纳网站制作公司临沂企业网站建站模板
  • 培训做网站国内适合个人做外贸的网站有哪些
  • 我想卖自己做的鞋子 上哪个网站好中信银行网站怎么做的怎么烂
  • 在线网站建设工程标准godaddy 上传网站
  • 营销型网站方案ppt模板手机建站平台微点
  • 网站信息备案管理系统电商网页精品欣赏网站
  • 推广公司让实名认证怎么办系统优化设置
  • 公司网站 正式上线如何创建一个软件
  • app备案查询网站上海缪斯设计公司地址
  • 旅游小网站怎样做精不做全组建网站 多少钱
  • 天津城乡住房建设厅网站网站建设观点
  • 电子商务网站建设的认识tk网站免费
  • html网页设计网站开发报告企业做的网站费入什么科目
  • 网站建设辶金手指排名十三郑州经济技术开发区教师招聘公告
  • 企业网站建设课程体会西安网站制作定制
  • 网站主题服务公司管理软件免费版
  • 网站建设主要职责六安网站建设
  • wordpress电影站主题一般做兼职在哪个网站
  • 可信网站友链怎么做网站建设行业标准
  • 济南营销网站制作公司哪家好口碑好的家装前十强
  • 公司网站开发费账务处理做图表的网站推荐
  • 网站如何做好用户体验wordpress 文章类