task "mytask1","192.168.137.3", sub {
say run "hostname";
};
run 函数是在哪里呢?
Rex::Commands::Run - 执行远程命令
[root@node01 Rex]# perldoc -l Rex::Commands::Run
/usr/local/perl/lib/site_perl/5.22.1/Rex/Commands/Run.pm
加入一段:
sub run {
print "ddad2313\n";
my $cmd = shift;
[root@node01 Rex]# rex mytask1
[2017-05-12 12:58:12] WARN - Please use only the following characters for task names:
[2017-05-12 12:58:12] WARN - A-Z, a-z, 0-9 and _
[2017-05-12 12:58:12] WARN - Also the task should start with A-Z or a-z
[2017-05-12 12:58:12] WARN - You can disable this warning by setting feature flag: disable_taskname_warning
[2017-05-12 12:58:12] WARN - Please use only the following characters for task names:
[2017-05-12 12:58:12] WARN - A-Z, a-z, 0-9 and _
[2017-05-12 12:58:12] WARN - Also the task should start with A-Z or a-z
[2017-05-12 12:58:12] WARN - You can disable this warning by setting feature flag: disable_taskname_warning
[2017-05-12 12:58:12] WARN - Please use only the following characters for task names:
[2017-05-12 12:58:12] WARN - A-Z, a-z, 0-9 and _
[2017-05-12 12:58:12] WARN - Also the task should start with A-Z or a-z
[2017-05-12 12:58:12] WARN - You can disable this warning by setting feature flag: disable_taskname_warning
[2017-05-12 12:58:12] INFO - Running task mytask1 on 192.168.137.3
ddad2313
node2
就是这个方法
rex run
转载本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
上一篇:rex 上传文件并远程执行
下一篇:rex 管理定时任务
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章