禅道7.1,管理了公司所有项目。需要每月备份。
主机安装在一台windows上。为了方便,写个脚本自动调用禅道的备份功能,并把服务器上的备份文件下载到本地。
@echo off setlocal rem 相关变量,根据自己的需要修改 set HOST=www.example.com set PORT=80 set BACKUP_USER=backup set BACKUP_PASSWD=backup_passwd set UNC_ZENTAO=\\%HOST%\d$\xampp\zentao set UNC_USER=administrator set UNC_PASSWD=no_password rem 备份 echo backup zentao now... wget --keep-session-cookies --save-cookies cookies.txt --post-data "account=%BACKUP_USER%&password=%BACKUP_PASSWD%&referer=http%3A%2F%2F%HOST%%3A%PORT%%2Fzentao%2Fbackup%2F" "http://%HOST%:%PORT%/zentao/user-login.html" wget --load-cookies=cookies.txt "http://%HOST%:%PORT%/zentao/backup-backup-yes.html" del cookies.txt del *.html echo. echo backup success. rem 复制文件 echo. echo copy backup file to local... net use x: /delete 2>nul >nul net use x: %UNC_ZENTAO% /USER:%UNC_USER% %UNC_PASSWD% >nul set TODAY=%date:~0,4%%date:~5,2%%date:~8,2% set MONTH=%date:~0,4%%date:~5,2% md %MONTH% 2>nul xcopy x:\tmp\backup\%TODAY%*.php %MONTH% /v/y net use x: /delete >nul echo. echo backup finished.
时间: 2024-11-08 17:42:56