Execute LXC Pre-shutdown/stop script

Fathi

Renowned Member
May 13, 2016
133
4
83
52
Tunis, Tunisia
Hi,
I am suspecting postgresql from pgdg yum repo to not stop when lxc container is instructed to stop/shutdown and thus preventing my configured backups to occur.
Is there a way to instrcut proxmox to run a script inside the container (script path relative to the container) before stopping/shutting down the container ?
TIA
 
PVE issues a "shutdown" to the container, not a hard stop, so you should be able to just add a systemd target (or similar) in your container that runs on "shutdown". Alternatively, look into hookscripts: These are scripts that can be placed on the PVE host and then attached to a container - they'll be run before and after a backup or shutdown, among other points, and you could for example SSH into your container at that point and perform any cleanup actions. See our wiki, docs, and search this forum for more info.
 
  • Like
Reactions: Fathi

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!