我在 Ubuntu 20.04 桌面上运行 Virtualbox 6.1,并使用 Webmin 运行一个非常简单的 cron 作业来每日拍摄我的 virtualbox 测试服务器的快照,如下所示:
VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot"
如果我从终端运行该命令,它会顺利执行。
问题:
但是,如果我将原始命令放入 Webmin cron 作业和/或 bash 包装器脚本中,然后放入 cron 作业中,该命令将 -反复- 在一小时内执行。删除/创建/删除/创建快照。
问题:
有谁知道为什么上述命令作为 cron 作业执行时会出现问题?
附加信息: 正如 crontab 中出现的命令。
* 5 * * * VBoxManage snapshot VminServer delete "TEST Daily Snapshot" && VBoxManage snapshot VminServer take "TEST Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday
输出grep "VboxManage" /var/log/syslog
:
Oct 19 05:00:01 timbuktu CRON[495412]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:01:01 timbuktu CRON[496151]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:02:01 timbuktu CRON[496962]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:03:01 timbuktu CRON[498024]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:04:01 timbuktu CRON[498782]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:05:01 timbuktu CRON[499619]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:06:01 timbuktu CRON[500360]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:07:01 timbuktu CRON[501272]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:08:01 timbuktu CRON[502180]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:09:01 timbuktu CRON[503025]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:10:01 timbuktu CRON[503871]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:11:01 timbuktu CRON[504641]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:12:01 timbuktu CRON[505454]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:13:01 timbuktu CRON[506230]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:14:02 timbuktu CRON[507093]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:15:01 timbuktu CRON[507930]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:16:01 timbuktu CRON[508710]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:17:01 timbuktu CRON[509551]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:18:01 timbuktu CRON[510372]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:19:01 timbuktu CRON[511188]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:20:01 timbuktu CRON[512150]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:21:01 timbuktu CRON[512931]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:22:01 timbuktu CRON[513723]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:23:01 timbuktu CRON[514696]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:24:01 timbuktu CRON[515473]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:25:01 timbuktu CRON[516221]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:26:01 timbuktu CRON[517063]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:27:01 timbuktu CRON[517790]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:28:01 timbuktu CRON[518548]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:29:01 timbuktu CRON[519292]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:30:01 timbuktu CRON[520023]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:31:01 timbuktu CRON[520797]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:32:01 timbuktu CRON[521771]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:33:01 timbuktu CRON[522523]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:34:01 timbuktu CRON[523264]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:35:01 timbuktu CRON[523976]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:36:01 timbuktu CRON[524757]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:37:01 timbuktu CRON[525540]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:38:01 timbuktu CRON[526225]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:39:01 timbuktu CRON[526942]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:40:01 timbuktu CRON[527681]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:41:01 timbuktu CRON[528440]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:42:02 timbuktu CRON[529212]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:43:01 timbuktu CRON[530342]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:44:01 timbuktu CRON[531348]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:45:01 timbuktu CRON[532135]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:46:01 timbuktu CRON[533003]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:47:01 timbuktu CRON[533827]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:48:01 timbuktu CRON[534843]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:49:01 timbuktu CRON[535601]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:50:01 timbuktu CRON[536361]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:51:01 timbuktu CRON[537130]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:52:01 timbuktu CRON[537885]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:53:01 timbuktu CRON[538610]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:54:01 timbuktu CRON[539426]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:55:01 timbuktu CRON[540166]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:56:01 timbuktu CRON[540892]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:57:01 timbuktu CRON[541619]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:58:01 timbuktu CRON[542368]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
Oct 19 05:59:01 timbuktu CRON[543089]: (root) CMD (VBoxManage snapshot VminServer delete "TEST - Daily Snapshot" && VBoxManage snapshot VminServer take "TEST - Daily Snapshot" #This script deletes re-creates a snapshot of Test server everyday)
没有错误...只是一个重复的命令。
答案1
您让它在早上 5 点每分钟运行一次。更改此设置:
* 5 * * * VBoxManage ...
对此
0 5 * * * VBoxManage ...