📄 init_cache.cgi
字号:
#!/usr/local/bin/perl# init_cache.cgi# Initialize the cache by running squid with the -z optionrequire './squid-lib.pl';&ReadParse();$whatfailed = "Failed to initialize cache";# set user to run squid as..$conf = &get_config();if (!$in{'nouser'}) { $in{'user'} || &error("You must choose a user to run Squid as"); @uinfo = getpwnam($in{'user'}); @ginfo = getgrgid($uinfo[3]); if ($squid_version < 2) { $dir = { 'name' => 'cache_effective_user', 'values' => [ $in{'user'}, $ginfo[0] ] }; &save_directive($conf, "cache_effective_user", [ $dir ]); } else { $dir = { 'name' => 'cache_effective_user', 'values' => [ $in{'user'} ] }; &save_directive($conf, "cache_effective_user", [ $dir ]); $dir = { 'name' => 'cache_effective_group', 'values' => [ $ginfo[0] ] }; &save_directive($conf, "cache_effective_group", [ $dir ]); } &flush_file_lines(); }# Initialize the cache$| = 1;($user, $group) = &get_squid_user($conf);if ($user) { foreach $c (split(/\s+/, $in{'caches'})) { mkdir($c, 0755); } }&chown_files($user, $group, $conf);&header("Initialize Cache", "");print "<hr>\n";$cmd = "$config{'squid_path'} -z";print "<p>Initializing the Squid cache with the command <tt>$cmd</tt> ..<br>\n";print "<pre>\n";open(INIT, "$cmd 2>&1 |");while(<INIT>) { print; }close(INIT);print "</pre>\n";print "<hr>\n";&footer("", "squid index");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -