开发者

How to set site in maintenance mode trough shell-script?

For my next project I will use automatic deployments with git. I can run a shellscript before and after deployment. Is it possible to set "maintenance" automatically with shell?

In my .htaccess then I would check if a server variable is set to deployment or not to do the rewrite to maintenance?

Is this 开发者_开发技巧possible and how should I handle this?


You could have the .htaccess check for the existence of a file with a certain name, and if it exists, redirect to a static "please hold" page. Then, in your before script, to put the site into maintenance mode, you just touch the file. In your after script, rm it.

Example:

RewriteCond /path/to/maintmode -f
RewriteRule ^(.*)$ maintpage.htm?frompage=$1 [L]

So, to put your app in maintenance mode, do:

touch /path/to/maintmode

To restore to live mode:

rm /path/to/maintmode
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜