@Shigure
I suggest you to run this inside truenas cron jobs. And configure nextcloud to use cron. This will fetch the right pod and container and run the cron inside. You have to set your truenas cron to execute like */5 Minutes.
Code:
NEXTCLOUDPOD=$(k3s kubectl get -o wide -n ix-nextcloud --field-selector=status.phase==Running pods | grep 'nextcloud-[0-9]' | awk '{ print $1; }'); k3s kubectl exec -n ix-nextcloud -c nextcloud -i "$NEXTCLOUDPOD" -- su -s /bin/bash www-data -c 'php -d memory_limit=-1 -f /var/www/html/cron.php'
To run something from the occ commands inside the container you can use the same command from your zsh and just alter the COMMAND after occ part:
Code:
NEXTCLOUDPOD=$(k3s kubectl get -o wide -n ix-nextcloud --field-selector=status.phase==Running pods | grep 'nextcloud-[0-9]' | awk '{ print $1; }'); k3s kubectl exec -n ix-nextcloud -c nextcloud -i "$NEXTCLOUDPOD" -- su -s /bin/bash www-data -c 'php -d memory_limit=-1 occ COMMAND'