我需要使用以下三条规则来分类我的电子邮件: 如果电子邮件发送到任何 @ somedomain.tld,则将该电子邮件复制到“somedomain_tld” 如果电子邮件发送到任何其他 @ *。tld,则将该电子邮件复制到“others_tlds”。 (any other =“not somedomain.tld”) 其余的电子邮件,复制到第三个文件夹“rest”。 我正在使用鸽舍筛分规则来做到这一点。 还有一个额外的条件:上面的三条规则必须适用于电子邮件中的每个“收件人:”地址…所以在最复杂的情况下,应该将电子邮件复制到三个文件夹中 例如:以下电子邮件应该被复制到三个文件夹: From: [email protected] To: [email protected], [email protected], [email protected] Subject: Test Email This is a test email 由于“[email protected]”,这封电子邮件应该被复制到“somedomain_tld” 由于“[email protected]”,这封电子邮件应该被复制到“others_tlds” 由于“[email protected]”这个电子邮件应该被复制到“rest” 要求和第一条规则很简单: require ["fileinto","copy"]; if address :is :domain "to" "somedomain.tld" { fileinto :copy "somedomain_tld"; } 但第二个不知道该怎么做: if address :matches :domain "to" "*.tld" { fileinto […]
像一个URI /一个部分/一些部位/另一部分/后部分/?some_param = SOME_VALUE 我怎么去除一切到最后一部分的参数,并最终重写它看起来像 /index.php?id=last-part&some_param=some_value ?。 我尝试了各种各样的魔法,但最接近的是去除了问号。
我有一个旧的方法来杀死闲置的mosh-server进程,这在我的新VPS上不起作用。 这是旧的方法,我在root的crontab中运行,以清理已经闲置10天以上的mosh进程: for tty in `w -sf | grep -P '\d\ddays mosh-server' | cut -c 10-15`; do kill -9 `ps -o pid= -t $tty`; done 问题是,在新的VPS上,这些进程没有TTY,所以我不能通过TTY匹配并以这种方式杀死mosh。 这是我到目前为止(顺便说一下,新的VPS在Debian上运行内核3.2,旧版本是以前的Debian版本)。 for loginday in `w | grep -P '\d\ddays.* mosh-server' | cut -c 34-40 | sed 's/^\([0-9]*\)\([a-zA-Z]*\).*$/\2 \1/'`; do echo $loginday; done 我正在尝试从'w'获取logindate,并将其与'ps'中的信息相关联: ps -C mosh-server -o bsdstart 因此,我可以关联login当天启动的任何闲置mosh-server会话(可能是野性中的99.9%),并使用'ps'来获取pid。 […]
请忍受我,因为我不是专家pipe理员 我有一个已经运行了几年的Linux邮件服务器,现在突然间某个用户无法发送邮件。 他们立即得到“系统pipe理员”的回应 501 5.5.4 error bad notify parameter syntax 这只会发生在这个用户,只有在他们的电脑上。 它在Thunderbird中正常工作,但在Outlook 2013中不起作用。其他用户可以毫无问题地使用Outlook 2013。 我看了日志,这就是这个用户试图发送电子邮件时说的 replacing command "RCPT TO: <[email protected]> NOTIFY=SUCCESS,FAILURE,DELAY" with "RCPT TO: <[email protected]> NOTIFY=SUCCESS,FAILURE,DELAY NOTIFY=NEVER" 我检查了任何可能添加标题,禁用电子邮件病毒扫描程序,重新添加帐户等的Outlook规则。 我一直在阅读,似乎NOTIFY =从不能与任何其他NOTIFY命令混合 我有一个这样的smtpd_command_filter设置 /^(RCPT\s+TO:<.*>.*)\s+NOTIFY=\S+(.*)/ $1 NOTIFY=NEVER$2 /^(RCPT\s+TO:.*)/ $1 NOTIFY=NEVER 我不擅长正则expression式,但我猜测它不是正确parsing原始命令,并且正在添加NOTIFY = NEVER而不是replace它。 在此期间,我已经评论说,发送“您的消息已成功交付”的通知发回给发件人。 我通过join使其沉默 smtpd_discard_ehlo_keywords = silent-discard, dsn 到main.cf 我的新设置是好还是我需要修复原来的问题,我猜是在正则expression式? 有任何想法吗?
我需要将通过某个掩码转到邮箱的所有电子邮件转发到一个特定的邮箱。 例如,如果收件人邮件是79001234567它应该被转发。 从/etc/postfix/main.cf行 virtual_alias_maps = $alias_maps, $virtual_maps, ldap:/etc/postfix/imap-aliases.cf, ldap:/etc/postfix/imap-groups.cf, regexp:/etc/postfix/dummyregexp 这里是我使用的正则expression式:/ etc / postfix / dummymail /^7\d{10}@domain.tld/ [email protected] / var / log / maillog的一部分 Mar 17 01:39:23 mail postfix/smtpd[24228]: connect from mail-qa0-f52.google.com[209.85.216.52] Mar 17 01:39:23 mail postfix/smtpd[24228]: setting up TLS connection from mail-qa0-f52.google.com[209.85.216.52] Mar 17 01:39:24 mail postfix/smtpd[24228]: Anonymous TLS connection established from mail-qa0-f52.google.com[209.85.216.52]: TL […]
我试图通过一个Apache反向代理基于客户端IP地址设置一些特定的标题。 我尝试使用SetEnvIfNoCase / SetEnvIf,但我不知道怎么写一个正确的正则expression式🙁 这里我试图在httpd.conf中设置(假设反向代理指令正常 – 它们是): SetEnvIfNoCase Remote_Addr "192\.168*" user_location_internal RequestHeader set x-acme-user-location internal env=user_location_internal 可以说,请求来自192.168.1.100。 然后正则expression式应该匹配 – 我尝试了几个在线validation器声称是perl兼容和192.168.1.100匹配到“192.168 *”。 SetEnvIf的文档也声明为perl reg ex兼容。 但是它不起作用。 唯一有效的语法如下: SetEnvIfNoCase Remote_Addr 192* user_location_internal RequestHeader set x-acme-user-location internal env=user_location_internal 然后设置头文件,这个问题与正则expression式语法有关。 所以我最好的猜测是,我没有正确地逃脱这个点。 但根据: http : //perldoc.perl.org/perlre.html#Regular-Expressions反斜杠是转义元字符的正确符号。 任何猜测什么是错的?
我需要重写几个url,如果这些url没有结束某些单词。 例如,我需要重写下面的url /category1/subcategory1/aproduct-url-title to /category1/fixedword/aproduct-url-title 重写不应该发生在下面的url上,因为这些链接以某些特定的词结束(view-all,p10,p20,p30,从低到高,从高到低) – /category1/subcategory1/view-all /category1/subcategory1/p10 /category1/subcategory1/p20 /category1/subcategory1/low-to-high /category1/subcategory1/high-to-low 我试着用下面的规则没有成功 – RewriteRule ^(category1|category2)\/(.*)\/(!p[0-9]+|view-all|low-to-high|high-to-low)$ /$1/fixedword/$3 我也试过以下规则 – RewriteCond %{REQUEST_URI} !(p[0-9]+|view-all|low-to-high|high-to-low)$ RewriteRule ^(category1|category2)\/(.*)\/(.*)$ /$1/fixedword/$3 感谢你的帮助。 谢谢
在试图重写 site-search.html?searchword=search%20term 如 advanced-search#q=search%20term 我总是以advanced-search#q=%3Fsearchword%3search%20term %3Fsearchword%3部分被神秘地添加到正好在search词之前的生成的URL中。 我现在的规则如下: RewriteCond %{REQUEST_URI} ^/site-search\.html$ RewriteCond %{QUERY_STRING} ^searchword=(.*)$ RewriteRule ^(.*)$ http://www.example.com/advanced-search#q=%1 [R=301,L,NE] 值得一提的是,在“q =”之后,我没有什么不同。 无论如何也会发生同样的错误或轻微的变化。
我用-n开关使用nagios插件check_snmp_int。 帮助显示: -n, –name=NAME Name in description OID (eth0, ppp0 …). This is treated as a regexp : -n eth will match eth0,eth1,… Test it before, because there are known bugs (ex : trailling /) 所以它应该与正则expression式,但它看起来不像。 我试图匹配适配器“Marvell Yukon 88E8056 PCI-E千兆位以太网控制器”的确切描述,但是它给了我匹配这个string的所有适配器,或者什么也不是。 我也有其他适配器名称: Marvell Yukon 88E8056 PCI-E Gigabit Ethernet Controller – Deterministic Network Enhancer Miniport Marvell Yukon […]
我有一个包含许多条目列表的日志文件。 用grep正则expression式我想匹配第一个单词和另一个可以在任何string中的单词。 例如,如果我指定“user1”,search将search: grep -E '^(IP_CONNECT|IP_DISCONNECT) user1' file.txt 然而,这将不匹配,除非user1在string的开始,而我想匹配它,如果它出现在string中的任何地方。 这是怎么做的?