Backup specific files in container from host

You can run that command in the background by starting it with & and capturing the pid with $1 and then killing it when you’re done.

Something like:

#!/bin/bash
set -ex

lxc file mount c1/ /home/user/foo &
pid=$!
#Wait for mount to occur
sleep 1
ls /home/user/foo
kill $pid
1 Like