LXC Startbedingung

Saufbefehl

New Member
Jan 21, 2022
1
0
1
44
Hi,

gibt es eine Möglichkeit einem LXC Container eine Startbedingung zu geben?
Zum Beispiel ein Skript das eine Bedingung prüft und dann mit exit 0 oder 1 beendet wird?

Hintergrund ist folgender, der Fileserver soll nicht starten wenn der Domaincontroller noch nicht läuft, oder ein verschlüsseltes zfs noch nicht entsperrt/gemountet wurde.

LG
Felix
 
Hey,

du kannst container mit pct start <id>[1] starten, jenachdem wie du deinen Domaincontroller startes(oder was mountest) kannst du ein Script starten welches dann prüfte ob alles passt und dann den Caintainer startet. Sowas wie:

Bash:
#!/bin/bash

grep -qs '/mnt/pve/isos' /proc/mounts || exit 0 # '/mnt/pve/isos' ist gemounted
pgrep -x 'domaincontr' > /dev/null || exit 0 # läuft ein Prozess mit dem Namen 'domaincontr'
...

pct start <ID>

Das Script sollte dann z.B. hier nachdem gemounted und nachdem der Domaincontroller gestartet worden ist aufgerufen werden.

[1] https://pve.proxmox.com/pve-docs/pv...ontainers_with_span_class_monospaced_pct_span
 

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!