Does Xcloner cleanup older backups from Amazon S3 | General Questions and Support | Forum Archive

The free forums are no longer in use. It remains available as read-only archive.

Avatar
Lost password?
Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
The forums are currently locked and only available for read only access
sp_TopicIcon
Does Xcloner cleanup older backups from Amazon S3
February 20, 2012
4:52 pm
Avatar
John
Member
Members
Forum Posts: 3
Member Since:
February 20, 2012
sp_UserOfflineSmall Offline

I am using xcloner to backup my website to the local server, then have the backup copied to an Amazon S3 account.  Works great!

 

However, even though xcloner cleans up older backups on the local server, it appears it does not clean up backups from the Amazon S3 account.

 

Is there a way to get xcloner to perform clean up on the Amazon S3 account automatically?

 

Thank you,

 

jhannan

February 20, 2012
6:10 pm
Avatar
Ovidiu Liuta
Admin
Forum Posts: 2484
Member Since:
September 26, 2010
sp_UserOfflineSmall Offline

At the moment, XCloner does not have that functionality built in, but it is on the dev list for a future version.

If you like to add it yourself, the code to edit is inside the cloner.cron.php file, and the amazon php class in classes/S3.php

 

Regards, Ovidiu

February 21, 2012
7:26 pm
Avatar
John
Member
Members
Forum Posts: 3
Member Since:
February 20, 2012
sp_UserOfflineSmall Offline

Thank you for the response.  Any chance you would have an example of the command line syntax to use?  I have no idea how to word the command, what to call.  Perhaps you can provide an example of sending a file delete command?

 

Thank you,

 

jhannan

February 22, 2012
8:22 am
Avatar
Ovidiu Liuta
Admin
Forum Posts: 2484
Member Since:
September 26, 2010
sp_UserOfflineSmall Offline

You will need to use the following method as defined in the S3 class

 

/**
* Delete an object
*
* @param string $bucket Bucket name
* @param string $uri Object URI
* @return boolean
*/
public static function deleteObject($bucket, $uri) {
$rest = new S3Request('DELETE', $bucket, $uri);
$rest = $rest->getResponse();
if ($rest->error === false && $rest->code !== 204)
$rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
if ($rest->error !== false) {
trigger_error(sprintf("S3::deleteObject(): [%s] %s",
$rest->error['code'], $rest->error['message']), E_USER_WARNING);
return false;
}
return true;
}

so when calling it from the cloner.cron.ph you would use

 

$s3->$deleteObject($_CONFIG['cron_amazon_bucket'], $_CONFIG['cron_amazon_dirname']."/".baseName($file))

Hope it helps

February 22, 2012
9:14 pm
Avatar
John
Member
Members
Forum Posts: 3
Member Since:
February 20, 2012
sp_UserOfflineSmall Offline

Thanks for the quick response!  Great support!

We are going to try this out and see if we can get it working.

 

Appreciate the help! Cool

Forum Timezone: America/Chicago
Most Users Ever Online: 867
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
mlguru: 30
Django29: 29
D: 21
Andy: 21
Marcus: 20
Jamie F: 19
Member Stats:
Guest Posters: 738
Members: 10049
Moderators: 2
Admins: 3
Forum Stats:
Groups: 3
Forums: 7
Topics: 2397
Posts: 8236
Newest Members:
ISIDORO ILARDO
Moderators: TriP: 0, Steve Burge: 0
Administrators: Ovidiu Liuta: 2484, Victor Drover: 1, Valentin Barbu: 0