⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 limit_run

📁 mysql+ha. 实现高可用性 http://code.google.com/p/mysql-master-master/
💻
字号:
#!/usr/bin/env perluse strict;if (scalar(@ARGV) < 2) {    print "ERROR: Usage: $0 <limit_seconds> <some command>\n\n";    exit(101);}my $timeout = shift(@ARGV);my @command = @ARGV;my $time = time();$SIG{ALRM} = \&Timeout;alarm($timeout);system(@command);alarm(0);# Analyze resultsif ($? == -1) {    print "ERROR: Failed to execute: $!\n";    exit(102);} elsif ($? & 127) {    printf "ERROR: Child died with signal %d, %s coredump\n", ($? & 127),  ($? & 128) ? 'with' : 'without';    exit(103);}exit($? >> 8);#------------------------------sub Timeout {    print "ERROR: Execution timed out (" . (time() - $time) ." sec)!\n";    exit(100);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -