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

📄 chown.cgi

📁 Unix下基于Web的管理工具
💻 CGI
字号:
#!/usr/local/bin/perl# chown.cgi# Change permissions on cache/log/pid files after a user changerequire './squid-lib.pl';$| = 1;&header("Change Ownership", "");print "<hr>\n";$conf = &get_config();# Stop squidif ($pidstruct = &find_config("pid_filename", $conf)) {	$pidfile = $pidstruct->{'values'}->[0];	}else { $pidfile = $config{'pid_file'}; }if (open(PID, $pidfile)) {	<PID> =~ /(\d+)/; $pid = $1;	close(PID);	}if ($pid && kill(0, $pid)) {	print "<p>Stopping squid ...<br>\n";	system("$config{'squid_path'} -f $config{'squid_conf'} ".	       "-k shutdown >/dev/null 2>&1");	for($i=0; $i<40; $i++) {		if (!kill(0, $pid)) { last; }		sleep(1);		}	print ".. Done<br>\n";	$stopped++;	}# Change ownershipprint "<p>Changing ownership ...<br>\n";($user, $group) = &get_squid_user($conf);&chown_files($user, $group, $conf);print ".. Done<br>\n";# Re-start Squidif ($stopped) {	print "<p>Re-starting Squid ...<br>\n";	$temp = &tempname();	system("$config{'squid_path'} -sY -f $config{'squid_conf'} >$temp 2>&1 </dev/null &");	sleep(3);	$errs = `cat $temp`;	unlink($temp);	if ($errs) {		system("$config{'squid_path'} -k shutdown -f $config{'squid_conf'} >/dev/null 2>&1");		print "Failed to re-start Squid ..<br>\n";		print "<pre>$errs</pre>\n";		}	print ".. Done<br>\n";	}print "<hr>\n";&footer("", "index");

⌨️ 快捷键说明

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