Pages: [1]   Go Down
Send this topic | Print
Author Topic: automatic backup of selected folders in root via cron?  (Read 635 times)
iM1
Authority Member
****
Offline Offline

Posts: 890


Why drink and drive when you can smoke and fly...


WWW
« on: August 12, 2008, 03:06:48 PM »

I need a script that can make automatic backups of selected folders in my account and then .gzip them or better .bzip2 files and folders.  (bzip2 compressed my 80mb db into 5mb)

Once the script has been made i can easily make it run automatically using cron.
Logged

My site is worth
My Sites:
iM1 MUSIC // DesiDrop - Music Blogs
Satize.com - MP3 Search Engine NEW V2!
d3xt3r
Guest
« Reply #1 on: August 12, 2008, 03:11:00 PM »

I need a script that can make automatic backups of selected folders in my account and then .gzip them or better .bzip2 files and folders.  (bzip2 compressed my 80mb db into 5mb)

Once the script has been made i can easily make it run automatically using cron.

There are many of these types of scripts available. Searching would help you a lot.

Also, we don't know your hosts specifications or abilities.. Such as the ability to GZIP items. Since you don't host here.
Logged
iM1
Authority Member
****
Offline Offline

Posts: 890


Why drink and drive when you can smoke and fly...


WWW
« Reply #2 on: August 12, 2008, 03:13:52 PM »


Ok i'll have a quick search now for some.

I think my host can pretty much do all the common stuff, its paid hosting so it cant be crap Duh
Logged

My site is worth
My Sites:
iM1 MUSIC // DesiDrop - Music Blogs
Satize.com - MP3 Search Engine NEW V2!
Mop (Gb)
Loyal 110MB Member
*******
Online Online

Posts: 4299


Don't Panic!


WWW
« Reply #3 on: August 12, 2008, 03:25:24 PM »

http://www.110mb.com/forum/timestamp-in-cronjob-backup-t33775.0.html

I'm guessing you use generic cPanel shared hosting...:
Summary:
Cron:
Code:
tar -cjf /home/yourUsername/backup.tar.bz2 /home/yourUsername/public_html
I suppose you'd want to label the day its from, so, to the end of that command,

php /home/yourUsername/renameBackup.php

renameBackup.php would be....
Code:
<?php
$newname
="/home/yourUsername/backup-" . date("U") . ".zip.bz2";
rename("/home/yourUsername/backup.tar.bz2", $newname);
?>

So, the cron altogether...

Code:
tar -cjf /home/yourUsername/backup.tar.bz2 /home/yourUsername/public_html; php /home/yourUsername/renameBackup.php


** I HAVEN'T TESTED THIS ** But I will right now... Tested!
« Last Edit: August 12, 2008, 03:38:50 PM by Mop (Gb) » Logged




Support conficker! Add dino to your sig!
Mop (Gb)
Loyal 110MB Member
*******
Online Online

Posts: 4299


Don't Panic!


WWW
« Reply #4 on: August 12, 2008, 03:37:17 PM »

Ok, I tested it. The shared host I was on didn't have zip, so, most cPanel hosts being quite similar, I will assume that yours doesn't either, and use tar & bzip2 (Which is better anyways).

I've edited the post with a working version.
Logged




Support conficker! Add dino to your sig!
Primefalcon
Linux Acolyte
Loyal 110MB Member
*******
Online Online

Posts: 4646


Follow the path of Linux, it will lead you....


« Reply #5 on: August 12, 2008, 06:36:17 PM »

e can can run cron and shell scripts on 110mb? I thought that would of been blocked
Logged

Dropbox is an amazing cloud storage backup solution, get a free 2.25 gigabytes of storage by using THIS LINK

For Tips on Runescape, Visit Marlaine's Musings For Tips on Just about anything Visit Marlainemarie at eHow
TDSii
Best warez site!!
Loyal 110MB Member
*******
Offline Offline

Posts: 2056


..:: skdown.net ::..


WWW
« Reply #6 on: August 12, 2008, 06:58:24 PM »

the idea is to check every visit for every user and if it passed the time it will run a script.
But the draw back that it is controlled by the user when he can terminate the php proccess any time he wants.
Cronjobs are no more than a folder inside linux where u can put bash scripts inside. Used them many times but never with php andmysql integrations.
Logged


inp o҉rtb
The Gangsta
Global Moderator
Official 110mb Guru
*****
Offline Offline

Posts: 15644


experimental theologian


WWW
« Reply #7 on: August 12, 2008, 11:56:46 PM »

e can can run cron and shell scripts on 110mb? I thought that would of been blocked

e cannot; you thought correctly.
Logged

Hi! I’m a signature virus! Add me to your signature to help me spread.
spam me: ispamspot@gmail.com

blog | my work @ deviantART | Imagine-ng image editor
Timothy Jacobs
Advanced Authority Member
*****
Offline Offline

Posts: 1069


"Welcome to the Grand Illusion" - STYX, 1977


WWW
« Reply #8 on: August 13, 2008, 12:12:54 AM »

e can can run cron and shell scripts on 110mb? I thought that would of been blocked
A quick reverse DNS would have told you he is not hosted here.
Logged





Pages: [1]   Go Up
Send this topic | Print
Jump to: