Kayako logo
SupportSuite, eSupport and LiveResponse Discussion, troubleshooting and feedback related to Kayako's flagship support desk products SupportSuite, eSupport and LiveResponse.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  (#1) Old
christinasc Offline
Member
 
Posts: 69
Join Date: May 2006
Cron job to backup Kayako owned DB? - 29-08-2006, 11:10 PM

Anyone here have a suggested method to backup the kayako db on a hosted owned version (other than the option in the admin panel where you click on 'Generate backup')

I would like to make it a cron job if possible, however i don't have root access to the server on which the DB resides. I do believe there is mysql access. Does anyone have anything already scripted for this ?

Thanks much in advance.
   
Reply With Quote
  (#2) Old
greengiant Offline
Member
 
Posts: 103
Join Date: Feb 2004
30-08-2006, 12:07 AM

If there is remote mysql access you can use a copy of the mysqldump command on your backup machine via cron to build the backup.

Command would look like
mysqldump -c -p PASSWORD -u USERNAME -h HOSTNAME DBNAME > /path/to/backup/file.sql
   
Reply With Quote
  (#3) Old
christinasc Offline
Member
 
Posts: 69
Join Date: May 2006
30-08-2006, 12:21 AM

Awesome! Thanks - i'll try it.
   
Reply With Quote
  (#4) Old
bear Offline
Community Moderator
 
Posts: 677
Join Date: Jan 2005
30-08-2006, 01:13 AM

If you're allowed to run a shell script on your server, here's a dandy:
(Edit to fit your site details, and make sure paths to sh and mysqldump and all that are correct for your server)
Code:
#!/bin/sh

# This script will backup one or more mySQL databases
# and then optionally email them and/or FTP them

# This script will create a different backup file for each database by day of the week
# i.e. 1-dbname1.sql.gz for database=dbname1 on Monday (day=1)
# This is a trick so that you never have more than 7 days worth of backups on your FTP server.
# as the weeks rotate, the files from the same day of the prev week are overwritten.
#/bin/sh /home/user/directory/scriptname.sh > /dev/null
############################################################
#===> site-specific variables - customize for your site

# List all of the MySQL databases that you want to backup in here, 
# each seperated by a space
# If not run by root, only one db per script instance
databases="mydbname"

# Directory where you want the backup files to be placed
backupdir=/home/mydomain/backups

# MySQL dump command, use the full path name here
mysqldumpcmd=/usr/bin/mysqldump

# MySQL Username and password
userpassword=" --user=myuser --password=mypasswd"

# MySQL dump options
dumpoptions=" --quick --add-drop-table --add-locks --extended-insert --lock-tables"

# Unix Commands
gzip=/bin/gzip
uuencode=/usr/bin/uuencode
mail=/bin/mail

# Send Backup?  Would you like the backup emailed to you?
# Set to "y" if you do
sendbackup="n"
subject="mySQL Backup"
mailto="me@mydomain.com"

#===> site-specific variables for FTP
ftpbackup="y"
ftpserver="myftpserver.com"
ftpuser="myftpuser"
ftppasswd="myftppasswd"
# If you are keeping the backups in a subdir to your FTP root
ftpdir="forums"

#===> END site-specific variables - customize for your site
############################################################

# Get the Day of the Week (0-6)
# This allows to save one backup for each day of the week
# Just alter the date command if you want to use a timestamp
DOW=`date +%w`

# Create our backup directory if not already there
mkdir -p ${backupdir}
if [ ! -d ${backupdir} ] 
then
   echo "Not a directory: ${backupdir}"
   exit 1
fi

# Dump all of our databases
echo "Dumping MySQL Databases"
for database in $databases
do
   $mysqldumpcmd $userpassword $dumpoptions $database > ${backupdir}/${DOW}-${database}.sql
done

# Compress all of our backup files
echo "Compressing Dump Files"
for database in $databases
do
   rm -f ${backupdir}/${DOW}-${database}.sql.gz
   $gzip ${backupdir}/${DOW}-${database}.sql
done

# Send the backups via email
if [ $sendbackup = "y" ]
then
   for database in $databases
   do
      $uuencode ${backupdir}/${DOW}-${database}.sql.gz > ${backupdir}/${database}.sql.gz.uu
      $mail -s "$subject : $database" $mailto < ${backupdir}/${DOW}-${database}.sql.gz.uu
   done
fi

# FTP it to the off-site server
echo "FTP file to $ftpserver FTP server"
if [ $ftpbackup = "y" ]
then
   for database in $databases
   do
      echo "==> ${backupdir}/${DOW}-${database}.sql.gz"
ftp -n $ftpserver <<EOF
user $ftpuser $ftppasswd 
bin
prompt
cd $ftpdir
lcd ${backupdir}
put ${DOW}-${database}.sql.gz
quit
EOF
   done
fi

# And we're done
ls -l ${backupdir}
echo "Dump Complete!"
exit
   
Reply With Quote
  (#5) Old
christinasc Offline
Member
 
Posts: 69
Join Date: May 2006
30-08-2006, 03:30 AM

Wow! you really rock, bear! thanks a million.
   
Reply With Quote
  (#6) Old
chimborazo Offline
New Member
 
Posts: 14
Join Date: Mar 2006
How could I use the script on a Windows Server? - 17-04-2007, 06:07 PM

HI, I really like that script, but I have no clou how this could be implemented on a Windows Server? Any ideas?
   
Reply With Quote
  (#7) Old
Jamie Edwards Offline
Operations Manager
 
Jamie Edwards's Avatar
 
Posts: 5,120
Join Date: Jan 2006
Location: United Kingdom
17-04-2007, 06:15 PM

Hi chimborazo,

You might like to do a Google search for "mysql backup php script" - there are several available on the web and involve uploading one PHP script and setting a system cron job ("scheduled task" in Windows) to execute this script every day, week and so on.

Documentation on how to set up a scheduled task in Windows Server 2003 is found in the manual: User manuals


Jamie Edwards (jamie.edwards ]at[ kayako.com)
----------------------------------------------------------------
---
  • New to the forum? New user's guide here.
  • Submit bug reports here.
  • Submit support tickets via the members area.
  • Submit sales queries either via live chat or via e-mail.
  • There is no official ETA on Version 4.
   
Reply With Quote
Reply

Tags
backup, cron, job, owned

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Kayako DB import into blank DB error christinasc SupportSuite, eSupport and LiveResponse 3 13-02-2007 11:14 PM
A nice backup for Kayako rohmelec SupportSuite, eSupport and LiveResponse 1 16-08-2006 06:35 PM



Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vBulletin Skin developed by: vBStyles.com


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46