📄 index.cgi
字号:
#!/usr/local/bin/perl# index.cgi# Display a list of all cron jobs, with the username and command for each onerequire './cron-lib.pl';%access = &get_module_acl();&header($text{'index_title'}, "", undef, 1, 1);print "<hr>\n";map { $ucan{$_}++ } split(/\s+/, $access{'users'});@jobs = &list_cron_jobs();@ulist = &unique(map { $_->{'user'} } @jobs);if ($access{'mode'} == 1) { @ulist = grep { $ucan{$_} } @ulist; }elsif ($access{'mode'} == 2) { @ulist = grep { !$ucan{$_} } @ulist; }foreach $u (@ulist) { if ((@uinfo = getpwnam($u)) && $uinfo[5] =~ /\S/) { $uname = "$u ($uinfo[5])"; } else { $uname = $u; } @jlist = grep { $_->{'user'} eq $u } @jobs; @plist = (); for($i=0; $i<@jlist; $i++) { local $rpd = &is_run_parts($jlist[$i]->{'command'}); local @exp = $rpd ? &expand_run_parts($rpd) : (); if (!$rpd || @exp) { push(@plist, [ $jlist[$i], \@exp ]); } } for($i=0; $i<@plist; $i++) { local $job = $plist[$i]->[0]; local @exp = @{$plist[$i]->[1]}; local $idx = $job->{'index'}; if (!$donehead) { print "<table border width=100%>\n"; print "<tr $tb> <td><b>$text{'index_user'}</b></td>\n"; print "<td><b>$text{'index_active'}</b></td>\n"; print "<td><b>$text{'index_command'}</b></td> </tr>\n"; $donehead = 1; } print "<tr $cb>\n"; if ($i == 0) { printf "<td valign=top rowspan=%d>", scalar(@plist); #if ($config{'vixie_cron'}) { # print "<a href=\"edit_env.cgi?$uname\">", # "$uname</a>"; # } #else { print $uname; } print $uname; print "</td>\n"; } printf "<td valign=top>%s</td>\n", $job->{'active'} ? $text{'yes'} : "<font color=#ff0000>$text{'no'}</font>"; if (@exp) { print "<td><a href=\"edit_cron.cgi?idx=$idx\">", join("<br>",@exp),"</a></td>\n"; } else { local $cmd = $job->{'command'}; $cmd =~ s/\\%/\0/g; $cmd =~ s/%.*$//; $cmd =~ s/\0/%/g; $cmd =~ s/&/&/g; $cmd =~ s/</</g; $cmd =~ s/>/>/g; printf "<td><a href=\"edit_cron.cgi?idx=$idx\">". "%s</a>%s</td>\n", length($cmd) > 60 ? substr($cmd, 0, 60) : $cmd !~ /\S/ ? "BLANK" : $cmd, length($cmd) > 60 ? " ..." : ""; } print "</tr>\n"; } }if ($donehead) { print "</table>\n"; }else { print "<b>$text{'index_none'}</b> <p>\n"; }print "<a href=\"edit_cron.cgi?new=1\">$text{'index_create'}</a> <p>\n";if ($config{cron_allow_file} && $config{cron_deny_file} && $access{'allow'}) { print "<h3><a href=edit_allow.cgi>$text{'index_allow'}</a></h3>\n"; }print "<hr>\n";&footer("/", $text{'index'});
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -