溫馨提示×

CentOS系統中VirtualBox虛擬機如何設置定時關機

小樊
55
2025-06-26 08:38:15
欄目: 云計算

在CentOS系統中使用VirtualBox設置虛擬機定時關機,可以通過以下幾種方法實現:

使用 shutdown 命令

  • 立即關機shutdown -h now
  • 在指定時間關機shutdown -h 分鐘數(例如:shutdown -h 10 表示10分鐘后關機)
  • 在指定日期和時間關機shutdown -h YYYY-MM-DD HH:MM(例如:shutdown -h 2025-06-10 18:00 表示當天18:00關機)。

使用 crontab 設置定時關機

  1. 打開終端。
  2. 輸入 crontab -e 編輯 /etc/crontab 文件。
  3. 在文件末尾加入如下行來設置定時關機:
    • 每天20:00關機:0 20 * * * root shutdown -h now
    • 每天22:00關機:0 22 * * * root shutdown -h now
    • 每天23:00關機:0 23 * * * root shutdown -h now。

使用 VirtualBox 的自動關機功能

  1. 打開VirtualBox并選擇要設置自動關機的虛擬機。
  2. 點擊虛擬機頂部的“設置”按鈕。
  3. 在彈出的設置窗口中,選擇“系統”選項卡。
  4. 在“系統”選項卡中,點擊“主板”選項卡。
  5. 在“主板”選項卡中,找到“電源”選項卡。
  6. 勾選“啟用關機按鈕”選項。
  7. 點擊“確定”按鈕保存設置。。

以上就是在CentOS VirtualBox虛擬機中設置定時關機的方法,你可以根據自己的需求選擇合適的方式。

0
亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女