Ubuntu

anacron 失敗,crontab 使用 automysqlbackup 成功

  • December 18, 2016

安裝和配置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 {} \;

理想情況下,這些消息都不會出現!從這裡怎麼去?

#!/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 {} \;

引用自:https://serverfault.com/questions/821454