PHP code example of itop / laravel-restic
1. Go to this page and download the library: Download itop/laravel-restic library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
itop / laravel-restic example snippets
return [
'restic_binary_path' => '/var/www/restic/restic',
'repositories' => [
'local' => [
'backup_paths' => [
'/var/www/katip/server/storage/',
'/var/www/katip/web/storage/'
],
'exclude_files' => [
'vendor'
],
'env' => [
'RESTIC_PASSWORD' => 'password',
'RESTIC_REPOSITORY' => '/var/www/backup',
]
],
'remote' => [
'backup_paths' => [
'/var/www/katip/server/storage/',
'/var/www/katip/web/storage/'
],
'exclude_files' => [
'vendor'
],
'env' => [
'RESTIC_PASSWORD' => 'password',
'RESTIC_REPOSITORY' => 'rest:https://user:password@host:port/user/',
]
],
],
];
$logPath = storage_path('logs/restic.log');
// Local repository
$schedule->command('restic:backup local')
->hourly()
->appendOutputTo($logPath);
$schedule->command('restic:forget local --keep-last=4')
->dailyAt('12:00')
->appendOutputTo($logPath);
// Remote repository
$schedule->command('restic:backup remote')
->hourly()
->appendOutputTo($logPath);
$schedule->command('restic:forget remote --keep-last=4')
->dailyAt('12:00')
->appendOutputTo($logPath);
bash
php artisan vendor:publish --provider="Itop\Restic\ResticServiceProvider"
bash
php artisan restic:backup local
bash
php artisan restic:snapshots local
bash
php artisan restic:forget local forget bdbd3439
bash
php artisan restic:prune local
bash
php artisan restic:forget --help