It was never so easy to get YouTube subscribers
Get Free YouTube Subscribers, Views and Likes

Automatically bind mount NFS/SMB/CIFS share to Proxmox LXC container after reboot with bash script

Follow
Automation Avenue

We will write a bash script and create a cron job that will automatically mount bind our NAS shares (NFS/SMB/CIFS) running on Proxmox VM to unprivileged LXC containers (also on Proxmox) after reboot.
Please also see previous video:
   • Bind mount NAS (CIFS/SMB/NFS) shares ...  
where we configured that share and LXC container connectivity.

***********
mount.sh script:

#!/usr/bin/env bash
qm start 202
until [ "$(qm status 202 | awk '{print $2}')" == "running" ];
do
sleep 2
done
sleep 20
mount t cifs o user=smbuser,password=marekpass //192.168.1.202/MiniPC /mnt/minipc
sleep 20
lxcstart n 203

**********

crontab e:
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
@reboot /usr/bin/bash /opt/scripts/mount.sh

*********

0:00 bind mount that works after reboot
14:00 writing bash script
19:35 creating cron job

Thank you for watching !
[email protected]

==28==

posted by unglogwk