Hexo : Error: Unexpected tag "asset_img

hexo deploy -g 時遇到以下問題

Error: Unexpected tag "asset_img 敏捷與Scrum軟體開發速成.jpeg 敏捷與Scrum軟體開發速成" on line 1.
at Object.exports.throwError (/blog/node_modules/swig/lib/utils.js:183:9)
at parseTag (/blog/node_modules/swig/lib/parser.js:544:13)
at /blog/node_modules/swig/lib/parser.js:640:15
at Object.exports.each (/blog/node_modules/swig/lib/utils.js:45:11)
at Object.exports.parse (/blog/node_modules/swig/lib/parser.js:624:9)
at parse (/blog/node_modules/swig/lib/swig.js:354:19)
at Object.precompile (/blog/node_modules/swig/lib/swig.js:486:23)
at Object.compile (/blog/node_modules/swig/lib/swig.js:606:16)
at commitMessage (/blog/node_modules/hexo-deployer-git/lib/deployer.js:159:15)
at Hexo.module.exports (/blog/node_modules/hexo-deployer-git/lib/deployer.js:26:17)
at Hexo.tryCatcher (/blog/node_modules/bluebird/js/release/util.js:16:23)
at Hexo.<anonymous> (/blog/node_modules/bluebird/js/release/method.js:15:34)
at /blog/node_modules/hexo/lib/plugins/console/deploy.js:55:28
at tryCatcher (/blog/node_modules/bluebird/js/release/util.js:16:23)
at Object.gotValue (/blog/node_modules/bluebird/js/release/reduce.js:155:18)
at Object.gotAccum (/blog/node_modules/bluebird/js/release/reduce.js:144:25)
at Object.tryCatcher (/blog/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/blog/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/blog/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromiseCtx (/blog/node_modules/bluebird/js/release/promise.js:606:10)
at Async._drainQueue (/blog/node_modules/bluebird/js/release/async.js:138:12)
at Async._drainQueues (/blog/node_modules/bluebird/js/release/async.js:143:10)

解決方法

原先加入圖片是使用以下方法,hexo 好像會認不出 tag

{% asset_img 敏捷與Scrum軟體開發速成.jpeg 敏捷與Scrum軟體開發速成 %}

所以必須將圖片名稱及描述加上"

{% asset_img "敏捷與Scrum軟體開發速成.jpeg" "敏捷與Scrum軟體開發速成" %}

使用 Docker 做 MongoDB 備份與還原與排程

備份步驟

產生 docker-mongodump image

# 下載 docker-mongodump
git clone https://github.com/RammusXu/docker-mongodump.git
# build 成 image
cd docker-mongodump
docker build -t rammus/mongodump .

直接備份

docker run --rm -v /root/mongodump:/backup --link mongo1:mongo -e MONGO_USERNAME=root -e MONGO_PASSWORD='rootpassword' rammus/mongodump no-cron

or

新增一個定期備份的 container

docker run -d -v /root/mongodump:/backup --link mongo1:mongo -e MONGO_USERNAME=root -e MONGO_PASSWORD='rootpassword' -e 'CRON_SCHEDULE=0 18 * * *' --name mongodump rammus/mongodump

Read More