New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Looking for PHP Backup script.
TehEnforce
Member
in Help
Anyone know and have experience with a PHP backup script?
My setup is: I have a site on shared webhosting. I need the files and MySQL files backupped up to a remote VPS automaticly every day. Now I know some but those arent automatic or encrypted and encryption is a must for me. Sending over FTP is also a nono.
Something like a password protected .zip backup or maybe something better and safer.
So anyone know a solution?
Comments
I would not use PHP for a backup script.
Something like rsync over ssh would be the way to go.
Along the lines of:
https://www.digitalocean.com/community/tutorials/how-to-create-an-off-site-backup-of-your-site-with-rsync-on-centos-6
Edit: The link points to a CentOS system, but the basic idea is the same on any 'nix system.
How about CDP?
http://cdp.me should do what you need.
@Magbanua
Thanks. I will try that out.
I wrote few times ago a little backup script in bash for my website.. It can be used with a cronjob, it backup files and mysql, encrypt and send all to dropbox with another bash script. Hope it will help you. I'm not a programmer so if anyone more expert than me want to comment
Need: https://github.com/andreafabrizi/Dropbox-Uploader
edit: Unfortunately the code with copy&paste is a shit..
If you need to generate passwords I suggest using either pwgen or openssl rand.
In this case however you are encrypting the password using your rsa public key. Why not skip some steps and just use gpg to encrypt the file with your gpg public key? You won't need to generate a password at all.
Because with gpg I had some issue (decrypt from windows, probably my mistakes) so I tried openssl and It's works.
Thanks but I am on shared hosting so I sadly don't have access to bash or SSH.
That's a pretty crappy shared hosting service that doesn't offer ssh access to your account.
rsync and key pair ssh connection?
I'm on shared hosting with directadmin and everything works well. Check if your provider accept outgoing traffic.
Sadly no SSH. Shared hosting.
@Rey
I am on DirectAdmin too. What do you mean with outgoing traffic?
No SSH support. My provider don't even support Let's Encrypt yet //
First of all download https://github.com/andreafabrizi/Dropbox-Uploader/archive/master.zip
Then in other machine with ssh make the setup.
Now you have the file .dropbox_uploader like this:
APPKEY:xxx
APPSECRET:xxx
ACCESS_LEVEL:sandbox
OAUTH_ACCESS_TOKEN:xxx
OAUTH_ACCESS_TOKEN_SECRET:xxx
Upload in your shared hosting the file.
Give the execution permission to the script dropbox_uploader.sh
Create a testfile.txt
Create a bash script with inside the code to upload your testfile.
Create the cronjob in your directadmin panel.
If your provider accept outgoing traffic and have curl enabled everything may works well
Even if you don't have SSH access you can still run Linux bash cronjobs from cPanel, either log the output to a file or check the crontab email for errors. Make sure you chmod the file to 770 or something sensible, your file has the proper shebang, and you include the full path to the script in cPanel cron jobs bit.
It might be worth asking your host for their advice before you start this, they might have some other options or ideas.
Didn't know of this, going to set it up on my MXRoute accounts tomorrow.
Thanks! Will try that.
@linuxthefish
Thanks! Going to ask my host and try that one out too.