anacron 失败,crontab 使用 automysqlbackup 成功

anacron 失败,crontab 使用 automysqlbackup 成功

安装和配置后ppadial/automysqlbackup在Ubuntu 16.04中出现以下结果:

anacron:
    /etc/cron.daily/runmysqlbackup:
    run-parts: failed to exec /etc/cron.daily/runmysqlbackup: Exec format error
    run-parts: /etc/cron.daily/runmysqlbackup exited with return code 1

crontab:
    /etc/cron.daily/runmysqlbackup: 1: /etc/cron.daily/runmysqlbackup: !/bin/sh: not  found
    Parsed config file "/etc/automysqlbackup/automysqlbackup.conf"

    # Checking for permissions to write to folders:
    base folder /var/backup ... exists ... ok.
    backup folder /var/backup/db ... exists ... writable? yes. Proceeding.
    chown: invalid option -- 't'
    Try 'chown --help' for more information

运行mysql备份:

!/bin/sh

/usr/local/bin/automysqlbackup /etc/automysqlbackup/myserver.conf

chown root.root /var/backup/db* -R find /var/backup/db* -type f -exec chmod 400 {} \; find /var/backup/db* -type d -exec chmod 700 {} \;

理想情况下,这些消息都不会出现!如何从这里到达那里?

答案1

#!/bin/sh

您的解释器未知,因此不知道如何执行,如错误所示

!/bin/sh: 未找到

在第一行的开头放置一个井号应该可以解决您的问题。

你可能想要的是

chown root.root /var/backup/db* -R
find /var/backup/db* -type f -exec chmod 400 {} \; 
find /var/backup/db* -type d -exec chmod 700 {} \;

相关内容