鍍金池/ 問答/Python  Linux  網(wǎng)絡(luò)安全  HTML/ 使用Python selenium調(diào)用phantomjs 后會在/tmp下產(chǎn)生大

使用Python selenium調(diào)用phantomjs 后會在/tmp下產(chǎn)生大量的tmp緩存文件,如何關(guān)閉?

使用Python selenium調(diào)用phantomjs 后會在/tmp下產(chǎn)生大量的tmp緩存文件,文件無內(nèi)容,但是占用大量系統(tǒng)資源,phantomjs如何關(guān)閉此類緩存文件?由于程序是每小時啟動一次,因此每天會產(chǎn)生很多此類tmp文件,除了手動刪除外,是否有其他方法關(guān)閉?

-rw------- 1 freedom freedom    0 2月  26 10:34 tmp3735g_
-rw------- 1 freedom freedom    0 2月  26 10:39 tmp3HR8Qd
-rw------- 1 freedom freedom    0 2月  26 10:35 tmp4DSGmV
-rw------- 1 freedom freedom    0 2月  26 10:35 tmp_9UmjE
-rw------- 1 freedom freedom    0 2月  26 10:39 tmpJ6tAuB
-rw------- 1 freedom freedom    0 2月  26 10:35 tmpkjM6Mb
-rw------- 1 freedom freedom    0 2月  26 10:35 tmpMwCZ1q
-rw------- 1 freedom freedom    0 2月  26 10:34 tmpptEuMa
-rw------- 1 freedom freedom    0 2月  26 10:38 tmprEYmPc
-rw------- 1 freedom freedom    0 2月  26 10:34 tmpsphtfq
-rw------- 1 freedom freedom    0 2月  26 10:36 tmpyXXWwC
freedom    4689   2003  0 10:38 pts/1    00:00:00 /usr/lib/phantomjs/phantomjs --cookies-file=/tmp/tmprEYmPc --webdriver=52321
freedom    4880   2003  0 10:39 pts/1    00:00:01 /usr/lib/phantomjs/phantomjs --cookies-file=/tmp/tmp3HR8Qd --webdriver=33829
freedom    5041   2003  0 10:39 pts/1    00:00:01 /usr/lib/phantomjs/phantomjs --cookies-file=/tmp/tmpJ6tAuB --webdriver=36861
回答
編輯回答
玄鳥

啟動 phantomjs 時設(shè)置 --cookies-file 參數(shù), 請參考 http://phantomjs.org/api/comm...

2018年1月27日 17:54