crontab

    https://forum.proxmox.com/threads/feature-request-hibernate-vms-on-pve-host-reboot.65529/post-452817

    让 PVE 在关机的时候 hibernat 容器,而不是直接停止,看评论说是在 roadmap 上了,但是目前还没看到。

    Hi,

    Here is my solution to hibernate all VMs at reboot or shutdown !
    It works for me. Thanks to @davidand for his script example :)

    Go in proxmox shell, you need to be root !

    vi /etc/init.d/proxmox

    Add this :

    Bash:

    #!/bin/sh
    case "$1" in
    start)
       qm list | awk -F'[^0-9]*' '$0=$2' | while read -r vm_id; do qm unlock $vm_id; done;
    ;;
    stop)
       qm list | grep running | awk -F'[^0-9]*' '$0=$2' | while read -r vm_id; do qm suspend $vm_id --todisk 1; done;
       sleep 10
    ;;
    esac
    exit 0

    chmod 755 /etc/init.d/proxmox

    ln -s /etc/init.d/proxmox /etc/rc3.d/S99proxmox
    ln -s /etc/init.d/proxmox /etc/rc0.d/K99proxmox
    ln -s /etc/init.d/proxmox /etc/rc6.d/K99proxmox

    systemctl daemon-reload
    systemctl start proxmox

    Don't forget to add autostart option in proxmox to the VMs that have to boot on start.

    Enjoy ! :)

    You can reboot or shutown your server from :

    • Physical buttons
    • Proxmox Gui buttons
    • in shell : restart now / shutdow now
    0 7 * * *  /usr/sbin/qm set 104 -net0 virtio=CA:A5:1B:27:9F:3D,bridge=vmbr0,firewall=0,rate=1.5
    40 9 * * 1-5  /usr/sbin/qm set 104 -net0 virtio=CA:A5:1B:27:9F:3D,bridge=vmbr0,firewall=0
    # For more information see the manual pages of crontab(5) and cron(8)
    #
    # m h  dom mon dow   command
联系方式

关于我

那年今日
19 月前

塑料用AB胶,玻璃用无影胶,石头用水泥,金属用焊接,手术用手术线缝合,衣服用针线,耳机单元用e8000,手机外壳用胶贴,屏幕用b700,鞋子用7900,pvc接管用PVC胶水,管螺纹螺丝防松密封用厌氧胶,补铸件用铸工胶,木板用白乳胶,电器绝缘密封用704硅橡胶,机械元件密封防油防水用丁晴胶, 昆虫标本耳机外壳填充造型用树脂胶,烤瓷牙用光固化树脂,DIY用热融胶,PCB防水用透明有机密封胶,防鞋线雨天进水烂线断线用502

20 月前

门寒花不弃,白头觅旧居;半生他乡客,叶落归乡泥。