( ! ) Deprecated: Function WP_Dependencies-&gt;add_data() was called with an argument that is <strong>deprecated</strong> since version 6.9.0! IE conditional comments are ignored by all supported browsers. in /var/www/html/wp-includes/functions.php on line 6131
Call Stack
#TimeMemoryFunctionLocation
10.0000484048{main}( ).../index.php:0
20.0007484400require( '/var/www/html/wp-blog-header.php ).../index.php:17
30.22694094656require_once( '/var/www/html/wp-includes/template-loader.php ).../wp-blog-header.php:19
40.23094123648include( '/var/www/html/wp-content/themes/twentyfifteen/single.php ).../template-loader.php:125
50.23094123648get_header( $name = ???, $args = ??? ).../single.php:10
60.23094123864locate_template( $template_names = [0 => 'header.php'], $load = TRUE, $load_once = TRUE, $args = [] ).../general-template.php:48
70.23094123960load_template( $_template_file = '/var/www/html/wp-content/themes/twentyfifteen/header.php', $load_once = TRUE, $args = [] ).../template.php:749
80.23134124504require_once( '/var/www/html/wp-content/themes/twentyfifteen/header.php ).../template.php:814
90.23144131912wp_head( ).../header.php:18
100.23144131912do_action( $hook_name = 'wp_head' ).../general-template.php:3197
110.23144132128WP_Hook->do_action( $args = [0 => ''] ).../plugin.php:522
120.23144132128WP_Hook->apply_filters( $value = '', $args = [0 => ''] ).../class-wp-hook.php:365
130.23164135544wp_enqueue_scripts( '' ).../class-wp-hook.php:341
140.23164135544do_action( $hook_name = 'wp_enqueue_scripts' ).../script-loader.php:2311
150.23164135760WP_Hook->do_action( $args = [0 => ''] ).../plugin.php:522
160.23164135760WP_Hook->apply_filters( $value = '', $args = [0 => ''] ).../class-wp-hook.php:365
170.23174137648twentyfifteen_scripts( '' ).../class-wp-hook.php:341
180.23194139168wp_style_add_data( $handle = 'twentyfifteen-ie', $key = 'conditional', $value = 'lt IE 9' ).../functions.php:440
190.23194139168WP_Styles->add_data( $handle = 'twentyfifteen-ie', $key = 'conditional', $value = 'lt IE 9' ).../functions.wp-styles.php:245
200.23194139168WP_Dependencies->add_data( $handle = 'twentyfifteen-ie', $key = 'conditional', $value = 'lt IE 9' ).../class-wp-styles.php:385
210.23194139168_deprecated_argument( $function_name = 'WP_Dependencies->add_data()', $version = '6.9.0', $message = 'IE conditional comments are ignored by all supported browsers.' ).../class-wp-dependencies.php:317
220.23194145120wp_trigger_error( $function_name = '', $message = 'Function WP_Dependencies->add_data() was called with an argument that is <strong>deprecated</strong> since version 6.9.0! IE conditional comments are ignored by all supported browsers.', $error_level = 16384 ).../functions.php:5925
230.23194264656trigger_error( $message = 'Function WP_Dependencies-&gt;add_data() was called with an argument that is <strong>deprecated</strong> since version 6.9.0! IE conditional comments are ignored by all supported browsers.', $error_level = 16384 ).../functions.php:6131

( ! ) Deprecated: Function WP_Dependencies-&gt;add_data() was called with an argument that is <strong>deprecated</strong> since version 6.9.0! IE conditional comments are ignored by all supported browsers. in /var/www/html/wp-includes/functions.php on line 6131
Call Stack
#TimeMemoryFunctionLocation
10.0000484048{main}( ).../index.php:0
20.0007484400require( '/var/www/html/wp-blog-header.php ).../index.php:17
30.22694094656require_once( '/var/www/html/wp-includes/template-loader.php ).../wp-blog-header.php:19
40.23094123648include( '/var/www/html/wp-content/themes/twentyfifteen/single.php ).../template-loader.php:125
50.23094123648get_header( $name = ???, $args = ??? ).../single.php:10
60.23094123864locate_template( $template_names = [0 => 'header.php'], $load = TRUE, $load_once = TRUE, $args = [] ).../general-template.php:48
70.23094123960load_template( $_template_file = '/var/www/html/wp-content/themes/twentyfifteen/header.php', $load_once = TRUE, $args = [] ).../template.php:749
80.23134124504require_once( '/var/www/html/wp-content/themes/twentyfifteen/header.php ).../template.php:814
90.23144131912wp_head( ).../header.php:18
100.23144131912do_action( $hook_name = 'wp_head' ).../general-template.php:3197
110.23144132128WP_Hook->do_action( $args = [0 => ''] ).../plugin.php:522
120.23144132128WP_Hook->apply_filters( $value = '', $args = [0 => ''] ).../class-wp-hook.php:365
130.23164135544wp_enqueue_scripts( '' ).../class-wp-hook.php:341
140.23164135544do_action( $hook_name = 'wp_enqueue_scripts' ).../script-loader.php:2311
150.23164135760WP_Hook->do_action( $args = [0 => ''] ).../plugin.php:522
160.23164135760WP_Hook->apply_filters( $value = '', $args = [0 => ''] ).../class-wp-hook.php:365
170.23174137648twentyfifteen_scripts( '' ).../class-wp-hook.php:341
180.25744265760wp_style_add_data( $handle = 'twentyfifteen-ie7', $key = 'conditional', $value = 'lt IE 8' ).../functions.php:444
190.25744265760WP_Styles->add_data( $handle = 'twentyfifteen-ie7', $key = 'conditional', $value = 'lt IE 8' ).../functions.wp-styles.php:245
200.25744265760WP_Dependencies->add_data( $handle = 'twentyfifteen-ie7', $key = 'conditional', $value = 'lt IE 8' ).../class-wp-styles.php:385
210.25744265760_deprecated_argument( $function_name = 'WP_Dependencies->add_data()', $version = '6.9.0', $message = 'IE conditional comments are ignored by all supported browsers.' ).../class-wp-dependencies.php:317
220.25744266080wp_trigger_error( $function_name = '', $message = 'Function WP_Dependencies->add_data() was called with an argument that is <strong>deprecated</strong> since version 6.9.0! IE conditional comments are ignored by all supported browsers.', $error_level = 16384 ).../functions.php:5925
230.25754266304trigger_error( $message = 'Function WP_Dependencies-&gt;add_data() was called with an argument that is <strong>deprecated</strong> since version 6.9.0! IE conditional comments are ignored by all supported browsers.', $error_level = 16384 ).../functions.php:6131

bash下利用trap捕捉信号

我在之前的文章里写了myisam读数据压缩的情况,最近决定把它用在生产环境上,所以避免不了写一个“安全”的处理脚本放在DB服务器上,这就引入了本文所讨论的话题。

我希望这个bash脚本在退出的时候做一些事情,包括:

  1. 它启动的切到后台的job需要被杀死;
  2. 一些临时文件的清理。

在这个脚本里我用到了trap这个命令,关于它,你可以man一下,我这里就不啰嗦了。直接上示例代码:

$ cat test_trap.sh

declare -i run_terminate=0

trap "run_terminate=1" SIGINT SIGTERM

# 启动io监控,IO较大时不进行压缩
vmstat 1 &gt;&gt; ./a.log &amp;

while [ ${run_terminate} -eq 0 ]
do
    # 核心代码
    sleep 30
done

for pid in $(ps -ef | awk -v p=${$} '{if ($3 == p){print $2}}')
do
    kill -9 ${pid} &gt; /dev/null
done

rm -f ./a.log
echo "Terminated."

在上面的代码中,我们捕捉INT信号(CTRL+C)和TERM信号(kill产生)。运行程序:

$ /bin/bash test_trap.sh

^C

按照我们预期的,当我CTRL+C退出程序,或者kill进程时,上面的脚本应该停掉vmstat进程,并且删除a.log,输出“Terminated”后退出。

但是,CTRL+C确实按照我们的设想进行了。可kill之后程序并没有任何反应,这是为何?

Google了一遍,天下文章一大抄,相似的例子,却没有人抛出这个问题。思索了半天,幡然醒悟:

  1. kill(killall)命令只是发出一个TERM信号(15),至于这个信号是否被对应进程捕捉并处理了,它并不管;
  2. kill发出的时候,test_trap.sh正在sleep——这个时间有点长(30秒)。

也就是说,等它“睡醒”了,它自然会处理TERM信号的。不信,你多等一会。

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.