Monday, September 24, 2012

automated backup of mysql and web site content to dropbox under text mode

I used to run a personal web site on a linux VPS, below is how I backup my sites and database content to dropbox.
(please note, not all these ideas came from me, I came across a few sources from internet and just put it together and make it work for me)

1. install dropbox on linux, see http://www.dropboxwiki.com/Text_Based_Linux_Install#Post-installation, I use folder /var/backup/Dropbox as dropbox folder.
2. use crontab to backup mysql and web content to dropbox folder, use compression to reduce bandwidth usage.
3. you can also you crontab to remove old backup files automatically.

purgeDropbox.sh:
#!/bin/bash
# limit on the size (in KB) of the directory
limit=1572864
adminmail=webmaster@yourdomain.com
# if directory exists, find out it's size
if [ -d /var/backup/Dropbox ]
then
  size=$(/usr/bin/du -sk /var/backup/Dropbox | cut -f1)
else
  echo "/var/backup/Dropbox is invalid !!!" | /bin/mail -s "Invalid directory" $adminmail
  exit
fi
# if directory size is greater than limit, alert the user
if [ $size -gt $limit ]
then
  echo "Data volume in your user home dir /var/backup/Dropbox with a total size of  ${size} kB exceeds the maximum limit of $limit kB (1.5 GB) ! Please take action!" |
 /bin/mail -s "user home dir exceeds max limit" $adminmail
   find /var/backup/Dropbox/redmine -name "*.gz" -mtime +30 -exec rm {} \; >> /root/purge.log 2>&1
fi
crontab entries:
30 20 * * *  mysqldump -u root -pPASSWORD --databases db1 db2 |gzip >/var/backup/Dropbox/database_$(date +\%Y\%m\%d__\%H:\%M:\%S\%z).sql.gz
00 19 * * * /root/purgeDropbox.sh
00 22 * * *  /bin/tar czfv /var/backup/Dropbox/web_$(date  +\%Y\%m\%d__\%H:\%M:\%S\%z).tar.gz /var/www

Saturday, August 25, 2012

Update Resource Cost rate Using PSI « Project Server And Sharepoint Solutions

Update Resource Cost rate Using PSI « Project Server And Sharepoint Solutions:

'via Blog this'

AJAX call web service behind ISA / TMG firewall with authentication

To be able to call web service behind ISA / TMG firewall, a few conditions need to be met:
1. use beforeSend when making the service call:

 $.ajax({
    url: weburl,
    beforeSend: function (xhr) { xhr.setRequestHeader ("Authorization", "Basic xxx"); }, 
    type: "POST",
    dataType: "xml",
    data: soapEnv,
    complete: processResult,
    contentType: "text/xml; charset=\"utf-8\""
   });

2. Basic authentication needs to be enabled on both ISA / TMG and IIS.
3. Enable keberos authentication for the published web app.
4. disable loopback check on the web server.

Sunday, June 10, 2012

Batch Import dtsx packages from folder to SSIS Store

FOR %i In (*.dtsx) DO dtutil /FILE "%i" /DESTSERVER LOCALHOST /COPY SQL;"\MYBI\Project Analysis\Initial Load\%~ni"

Disable Microsoft Defender for Cloud for Visual Studio Subscription (MSDN)

I use a visual studio pro subscription which comes with $150 azure cloud credit, for some reason Microsoft Defender for Cloud was turned on ...