fix volume sync task
This commit is contained in:
parent
22974cea02
commit
f5e66a96e7
2 changed files with 24 additions and 8 deletions
|
@ -4,16 +4,29 @@ global $cli;
|
|||
|
||||
use Utopia\CLI\Console;
|
||||
use Utopia\Database\DateTime;
|
||||
use Utopia\Platform\Action;
|
||||
use Utopia\Validator\Integer;
|
||||
use Utopia\Validator\Text;
|
||||
|
||||
$cli
|
||||
->task('volume-sync')
|
||||
->desc('Runs rsync to sync certificates between the storage mount and traefik.')
|
||||
->param('source', null, new Text(255), 'Source path to sync from.', false)
|
||||
->param('destination', null, new Text(255), 'Destination path to sync to.', false)
|
||||
->param('interval', null, new Integer(true), 'Interval to run rsync', false)
|
||||
->action(function ($source, $destination, $interval) {
|
||||
class VolumeSync extends Action
|
||||
{
|
||||
public static function getName(): string
|
||||
{
|
||||
return 'volume-sync';
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this
|
||||
->desc('Runs rsync to sync certificates between the storage mount and traefik.')
|
||||
->param('source', null, new Text(255), 'Source path to sync from.', false)
|
||||
->param('destination', null, new Text(255), 'Destination path to sync to.', false)
|
||||
->param('interval', null, new Integer(true), 'Interval to run rsync', false)
|
||||
->callback(fn ($source, $destination, $interval) => $this->action($source, $destination, $interval));
|
||||
}
|
||||
|
||||
public function action(string $source, string $destination, int $interval)
|
||||
{
|
||||
|
||||
Console::title('RSync V1');
|
||||
Console::success(APP_NAME . ' rsync process v1 has started');
|
||||
|
@ -42,4 +55,5 @@ $cli
|
|||
Console::success($stdout);
|
||||
Console::error($stderr);
|
||||
}, $interval);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -13,6 +13,7 @@ use Appwrite\CLI\Tasks\SSL;
|
|||
use Appwrite\CLI\Tasks\Usage;
|
||||
use Appwrite\CLI\Tasks\Vars;
|
||||
use Appwrite\CLI\Tasks\Version;
|
||||
use VolumeSync;
|
||||
|
||||
class TasksService extends Service
|
||||
{
|
||||
|
@ -29,6 +30,7 @@ class TasksService extends Service
|
|||
->addAction(Maintenance::getName(), new Maintenance())
|
||||
->addAction(Migrate::getName(), new Migrate())
|
||||
->addAction(SDKs::getName(), new SDKs())
|
||||
->addAction(VolumeSync::getName(), new VolumeSync())
|
||||
->addAction(Specs::getName(), new Specs());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue