I want to schedule the run of a command that back's up my sql database that is running inside a docker container, so that I can back this up externally using duplicati. I found a command that works when I run it in a shell, using either sudo or logging in as root and running it, but the command throws an error when I run it as a scheduled job in OMV. Here is the command.
docker exec -it zabbix-mysql /bin/bash -c 'mysqldump -u root -pmypassword zabbix > /var/lib/mysql/backups/zabbix.sql'
And here is the error the OMV throws when I try to run it as a scheduled job.
Failed to execute command 'export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin; export LANG=C.UTF-8; export SHELL=/bin/sh; sudo --shell --non-interactive --user=root -- docker exec -it zabbix-mysql /bin/bash -c 'mysqldump -u root -pmypassword zabbix > /var/lib/mysql/backups/zabbix.sql' 2>&1' with exit code '1': the input device is not a TTY
and the error details.
Error #0:
OMV\ExecException: Failed to execute command 'export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin; export LANG=C.UTF-8; export SHELL=/bin/sh; sudo --shell --non-interactive --user=root -- docker exec -it zabbix-mysql /bin/bash -c 'mysqldump -u root -pmypassword zabbix > /var/lib/mysql/backups/zabbix.sql' 2>&1' with exit code '1': the input device is not a TTY in /usr/share/openmediavault/engined/rpc/cron.inc:175
Stack trace:
#0 /usr/share/php/openmediavault/rpc/serviceabstract.inc(565): OMVRpcServiceCron->{closure}('/tmp/bgstatuszp...', '/tmp/bgoutputsY...')
#1 /usr/share/openmediavault/engined/rpc/cron.inc(179): OMV\Rpc\ServiceAbstract->execBgProc(Object(Closure))
#2 [internal function]: OMVRpcServiceCron->execute(Array, Array)
#3 /usr/share/php/openmediavault/rpc/serviceabstract.inc(123): call_user_func_array(Array, Array)
#4 /usr/share/php/openmediavault/rpc/rpc.inc(86): OMV\Rpc\ServiceAbstract->callMethod('execute', Array, Array)
#5 /usr/sbin/omv-engined(536): OMV\Rpc\Rpc::call('Cron', 'execute', Array, Array, 1)
#6 {main}
If no one can help me figure out what is causing the error and fix it, I am also willing to take suggestions on different ways to accomplish my goal of backing up the database.