Wednesday, November 29, 2006

Integrating Mantis Bug Tracking with Win32 TortoiseSVN

From http://manual.mantisbt.org/manual.configuration.source.control.integration.php

mike.junk@NOntlworldSPAM.com
25-Apr-2005 11:11 #419
Brief guide to TortoiseSVN integration on Win32. This will allow you to enter a Mantis issue number when doing an SVN commit, automatically add a note to the Mantis 'notes' log containing info about the change, and show a link to the issue from TortoiseSVN log.

1. Set properties for your SVN repository (e.g. in TortoiseSVN, use the file properties dialog) to include the following:
bugtraq:label = issue
bugtraq:url = http:///mantis/view.php?id=%BUGID%
bugtraq:message = issue %BUGID%
bugtraq:warnifnoissue = true

2. Create a post commit hook file in the SVN respository hooks directory (\hooks\post-commit.bat), containing the following batch commands. This will add a comment to the notes field for the issue provided during the SVN commit, containing the SVN change log, the SVN revision number and the file differences.

REM Post-commit hook for MantisBT integration
SET REPOS=%1
SET REV=%2
SET DETAILS_FILE=\svnfile_%REV%
SET LOG_FILE=\svnfile_%REV%_Log

echo ****** Source code change ******>>%DETAILS_FILE%
svnlook log -r %REV% %REPOS%>>%DETAILS_FILE%
echo SVN Revision:%REV%>>%DETAILS_FILE%
svnlook diff -r %REV% %REPOS%>>%DETAILS_FILE%

\php.exe \core\checkin.php <%DETAILS_FILE% >%LOG_FILE%
DEL %DETAILS_FILE%
DEL %LOG_FILE%

3. Add the following to your Mantis config_inc.php

#Integration to SVN
$g_source_control_notes_view_status = VS_PUBLIC;
$g_source_control_account = '';
$g_source_control_set_status_to = OFF;
$g_source_control_regexp = "/\bissue [#]{0,1}(\d+)\b/i";

Sunday, November 19, 2006

Dump database MySQL tiap hari

To backup MySQL everyday with simple shell script.
I'm using Ubuntu 5, MySQL 5.

Create a file at /etc/cron.daily .
Named, e.g. "backup-mysql" .
The content of the file is (between dashes) :
-------------------------------------------
#!/bin/sh

test -x /usr/bin/mysqldump || exit 0
/usr/bin/mysqldump --all-databases -u root --password=a | gzip - > /backup/mysql/mysql-`date +%F`.sql.gz
cd /backup/mysql
find . -atime +14 -delete

-------------------------------------------

#!/bin/sh
Tell the shell wich shell to run this script. Ubuntu default is bash shell.

test -x /usr/bin/mysqldump || exit 0
Check the /usr/bin/mysqldump is it there ? If not just exit.

/usr/bin/mysqldump --all-databases -u root --password=a | gzip - > /backup/mysql/mysql-`date +%F`.sql.gz
Dump all the databases from server with user 'root' and password 'a' (for example). Zipped with gzip and store at /backup/mysql. The file name generated differently every day prefixed with 'mysql-' follow by the date (from `date +%F`, it's a back quote pair).

cd /backup/mysql
find . -atime +14 -delete

Go to the folder and check if there are some file older than 14 days, delete it.

Tags: , , , , ,