Page 1 of 1
Copy web files to LAN
Posted: Mon 01 Feb 2021 7:04 pm
by KarlS
I'm running a local web server on a Win10 machine. I'd like to automatically copy the web files from the CumulusMX machine (Raspberry 4) over my LAN to the Windows server. Entering the local IP address plus path-to-local-server-files in the "Extra web files panel" and unchecking the FTP box didn't work. They ended up on the server of my ISP anyway. (I seem to remember that this worked in Cumulus 1, but I might be wrong, it was a long time ago).
Now, I'm not a Linux expert to figure out how to write a shell script/crontab job to transfer those files to my Windows server. What I could do on the Windows machine is use the command line version of WinSCP, put it into a batch/PowerShell job and run it every 10 minutes.
But maybe there is an easier solution and I just don't see it. Any help is appreciated.
Re: Copy web files to LAN
Posted: Mon 01 Feb 2021 7:10 pm
by mcrossley
The simplest way I think is to mount your Windows file share on the Linux filesystem. Then you can just specify the mount point folder in the extra files configuration and let Linux deal with the network in the background.
Re: Copy web files to LAN
Posted: Mon 01 Feb 2021 8:11 pm
by KarlS
Thanks Mark, that worked. At first
mount your Windows file share on the Linux filesystem
sounded a bit cryptic, but DuckDuckGo is my friend

. Now I have to figure out how to make the mount survive a reboot. But again, the web has answers for (nearly) everything ...
Re: Copy web files to LAN
Posted: Tue 02 Feb 2021 4:04 pm
by mcrossley
The Duck knows everything!

Re: Copy web files to LAN
Posted: Tue 02 Feb 2021 4:15 pm
by HansR
KarlS wrote: ↑Mon 01 Feb 2021 8:11 pm
Now I have to figure out how to make the mount survive a reboot.
Well, the mount does not survive the reboot, but after reboot you can test whether the other system is online
Code: Select all
if ( /sbin/showmount -e a.b.c.d )
then
echo "The NAS is online!"
if ( mount -t nfs -o defaults -v a.b.c.d:/volume1/WinFileShare $MNTDIR )
or similar.
Put that in the startup of the account and you're there.
Re: Copy web files to LAN
Posted: Tue 02 Feb 2021 4:34 pm
by KarlS
I was thinking of putting something like
Code: Select all
@reboot sudo mount -t cifs -o username=karl //192.168.8.215/cumulus /mnt/winshare
in crontab. I will have to use a response file to supply the password though ...
Re: Copy web files to LAN
Posted: Tue 02 Feb 2021 5:41 pm
by freddie
The way to persist between reboots is to add your mount details to /etc/fstab. But your method may work provided it is run with adequate privileges.
Re: Copy web files to LAN
Posted: Tue 02 Feb 2021 6:43 pm
by KarlS
@freddie
As I said in my original post, I'm not a Linux expert. However, I believe that if you put the Windows share in /etc/fstab, the system will not boot if the share - for whatever reason - is not present. If you try to mount it through the @reboot in crontab, it will just ignore the command when the share is not present.