Skip to content

Commit 642bfa5

Browse files
author
Shawn McCool
committed
add scheduling documentation
1 parent 8036df6 commit 642bfa5

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This package pulls in the framework agnostic [Backup Manager](https://github.com
1111
- [Stability Notice](#stability-notice)
1212
- [Requirements](#requirements)
1313
- [Installation](#installation)
14-
- [Usage](#usage)
14+
- [Scheduling Backups](#scheduling)
1515
- [Contribution Guidelines](#contribution-guidelines)
1616
- [Maintainers](#maintainers)
1717
- [License](#license)
@@ -118,6 +118,24 @@ php artisan db:backup --database=mysql --destination=dropbox --destinationPath=`
118118

119119
This command will backup your database to dropbox using mysql and gzip compresion in path /backups/YEAR/DATE.gz (ex: /backups/2015/29-10-2015.gz)
120120

121+
### Scheduling Backups
122+
123+
It's possible to schedule backups using Laravel's scheduler.
124+
125+
```PHP
126+
/**
127+
* Define the application's command schedule.
128+
*
129+
* @param \Illuminate\Console\Scheduling\Schedule $schedule
130+
* @return void
131+
*/
132+
protected function schedule(Schedule $schedule) {
133+
$date = Carbon::now()->toW3cString();
134+
$environment = env('APP_ENV');
135+
$schedule->command("db:backup --database=mysql --destination=s3 --destinationPath=/{$environment}/projectname_{$environment}_{$date} --compression=gzip")->twiceDaily(13,21);
136+
}
137+
```
138+
121139
### Contribution Guidelines
122140

123141
We recommend using the vagrant configuration supplied with this package for development and contribution. Simply install VirtualBox, Vagrant, and Ansible then run `vagrant up` in the root folder. A virtualmachine specifically designed for development of the package will be built and launched for you.

0 commit comments

Comments
 (0)