Advertisement:

Author Topic: Auto-backup via CRON  (Read 2279 times)

shragicz

  • Newbie
  • *
  • Posts: 26
Auto-backup via CRON
« on: February 23, 2012, 01:22:00 am »
Hi all,

I find out, you can do SQL backup via address field. It is enough insert this into your brovser and backup is done.

Code: [Select]
http://www.yourosclass.com/oc-admin/index.php?page=tools&action=backup&bck_dir=/directory/backup&action=backup-sql

BUT

LOGIN to admin panel is needed. Do you know, if exists solution, how call this without login? I would like to call this URL hourly with CRON.

THX, best

M.

_CONEJO

  • Administrator
  • Hero Member
  • *****
  • Posts: 4689
Re: Auto-backup via CRON
« Reply #1 on: February 23, 2012, 11:14:50 am »
Hi shragicz,


Unfortunately, for the moment there's nothing to do it. A plugin could be created and it should not be very difficult (just copy&paste some code). Or you could use some external tool as autoBackupMySQL ...

I will create a plugin in a few hours anyway ;)

Thank for the suggestion

_CONEJO

  • Administrator
  • Hero Member
  • *****
  • Posts: 4689
Re: Auto-backup via CRON
« Reply #2 on: February 23, 2012, 12:03:57 pm »
Hi,

Please, try the one attached here. You'll need to modify the index.php file, but it's explained and quite easy ;)

shragicz

  • Newbie
  • *
  • Posts: 26
Re: Auto-backup via CRON
« Reply #3 on: February 23, 2012, 12:23:19 pm »
Hi, thank you for very quick response, it is working fine

Steps for others:

1. unzil file to /plugins/ directory
2. install plugin via admin interface
call http://www.oscalsssite.com/index.php?page=cron

backup is done

Great work! Thank you very much ;-) I think this can be very useful for all users

M.

Swede

  • Sr. Member
  • ****
  • Posts: 388
Re: Auto-backup via CRON
« Reply #4 on: February 23, 2012, 01:06:40 pm »
2 questions for us noobs:

How do you configure cron?
Where is the backup stored?

_CONEJO

  • Administrator
  • Hero Member
  • *****
  • Posts: 4689
Re: Auto-backup via CRON
« Reply #5 on: February 23, 2012, 01:19:06 pm »
Hi,


1.- Some notes on CRON : http://wiki.osclass.org/Cron Please, full read, Explanation + how to configure + some cases
2.- Edit index.php of the plugin

Code: [Select]
// MODIFY THIS PATH TO THE ONE YOU WANT THE BACKUPS TO BE GENERATED
        // DO NOT USE A PUBLIC PATH
        $path = osc_base_path();

Change $path to whatever you want, consider putting it out of public view (if not, anyone will be able to download your database!)

I also recommend this one script (not osclass related!) : http://www.debianhelp.co.uk/mysqlscript.htm
I'm sure there're more like this, but I worked with this one. This has more options (multiple databases, keeps only the last 7 backups  to save space, SEND THE BACKUP via EMAIL -only for small databases-,...)
The problem is that the order of the backup is not the correct one for OSClass, so improt will fail and you will need to modify it by hand.

I wish I had the time to make the plugin as big and useful as this other script. With sometime, I think we could make it, at least, to be able to roate backups (save HD space) and send them via email or host in other place.

Thanks!

shragicz

  • Newbie
  • *
  • Posts: 26
Re: Auto-backup via CRON
« Reply #6 on: February 23, 2012, 04:56:02 pm »
I have one more question; why is there atached file conf.php? it seems to be connected with QRCodes

thanks

M.

_CONEJO

  • Administrator
  • Hero Member
  • *****
  • Posts: 4689
Re: Auto-backup via CRON
« Reply #7 on: February 23, 2012, 05:08:04 pm »
You could remove config.php safely.

I thought at first to create a mini config page, but realized it's a lot of work actually. (I copied it from another plugin to serve as template)