Create, download, and restore a backup of your Discourse database

Is there a way to create and download this backup file programmatically? I mean, I have some cron scripts on the server which do backups for tons of other services, can I issue a few CLI commands directly on the server to get the backup there? Maybe ./launcher app backup new-backup.backup or so?