File lock between host and guest - bash

I'm struggling with a niche case that should be simple...
I'm running mint on virtualbox on a windows host. There is a third-party remote server running windows server (2012 or 2016) and writing files to a NAS folder.
The remote server will write a large file and save it on the NAS folder, then my guest (linux) will be probing the folder for any changes and move the files to another folder and run a script.
Probing for the folder and running my script all works fine.
The issue is, how do I check if the server is still writing (file lock) to the file from within my guest OS?
I know file locks are OS dependent, and even implementation dependent, but is this behavior completely impossible? Should I just re-write my code for windows (probably Java) and forget about shell-script (was going to re-use previous code already working).
thank you for your help in advance.

Related

Is it possible to apply unattend.xml on custom prepared image when deploy new PC?

I've created custom Windows_10_PRO_1909_x64 image with hashicorp packer (with QEMU).
To build it I used unattend.xml file. Steps to prepare were:
Absolutely unattended installation of Windows
Installation of big amount of software
Converting VM (it was build with QEMU) to raw .img file
Now I want to deploy this image to new PC. I'm using bootable USB stick with embedded Linux (also custom) which can grab this .img file from local storage and write to /dev/sda
Everything works fine in this process.
Main problem is - after writing .img to /dev/sda I'm changing ComputerName in unatted.xml file (on mounted /dev/sda), but after first time boot, Windows ignores this file, and PC name is the same as it was before changing. When I checked unattend file, it has correct PC name, which I changed while was on bootable linux, before Windows first run.
Maybe somebody have an idea - how I can change PC name, each time I deploy new PC? But it should be without user interaction. It could be any file modification on bootable linux, or maybe there is a way to do it automatically on first Windows boot?
Found solution.
Need to run sysprep afer Windows install with sysprep-unattend.xml file to clean system.
After it Windows will catch this file on first boot. So it's possible to change PC name in this file before boot.

Virtual Box Shared folders on Mac backup to external harddrive

So I found out how to share folders using Virtual Box and running Windows 8.
I was wondering, if I save files or projects from Windows 8 to the shared folder on my Mac, will TimeMachine backup those files onto my external harddrive? The hard drive is of course formatted for Mac because of that whole debockel, but that is besides the point. Even though the files were made in Windows.
Also...My assumption is that I would not be able to access the files on my external formatted hard drive from Virtual Box running Windows 8. Is this true?
To my knowledge, you cannot access the files on a journaled formatted hard drive from Windows without extra software. If I understand you correctly, you are trying to backup files created in the Windows VM within your Time Machine backup hard drive?
I'm sure you have solved this by now, but you should consider backing up the VM itself. If the files on the Windows Machine are important you can leave them in a shared folder and have time machine back up that folder.

How copy,Paste is working form my local system to remote system

Recently we bought dedicated server with Windows.I really surprised windows allowing me to copy files(CTRL+C) from my local system and paste files(CTRL+P) in dedicated server.Vice versa.
Before we tried Linux dedicated server.If you want transfer file from local system(Windows) to dedicated server(Linux),I need to use FTP.But in windows server all these are not needed.
I have a curiosity to know,How the procedure is working internally.For this I search allot,But I didn't found clear materials.So If you know any good material,suggest me.
Thanks.
I'm not sure what your question is precisely. Are you using remote desktop to log into your windows server, and then copying and pasting files between your local system and the remote server? If that's the case, then the copying and pasting is happening within your "remote desktop" client. It's not really related to your server's operating system, per se.

How can I make my local server case-sensitive?

I'm on Windows Vista Home Premium 64 bit OS. I use Apache Friends XAMPP server as my localhost. And I develop PHP, MySQL.
The problem is my local server is tolerant of case mistakes, especially in file/folder names.
When that running program on my server goes on linux servers, it's really a headache to locate and correct all the case errors.
So how can I make my local server case-sensitive as in linux servers?
No you can't. PHP file handling is dependant on the underlying O. Since Windows is a case-insensitive OS, it cannot handle files with a different case.
This won't change, as it will break a lot of applications. NTFS is a case-sensitive filesystem according to this KB article.
If you have an old PC doing nothing, install a Linux server on it. Or if you have enough resources (RAM), run a Virtual machine (with VirtualBox for example)
case-sensitivity is not due to the web server it self, but to the operating system.
Linux is case-sensitive not windows. As far as i know, you can't make windows case-sensitive.
but try yo keep all your folders/files lowercase, this will save you much headeach when moving to linux production server.

Modifying files on remote Ubuntu server from Windows PC

I am developing some Python programs that I'm running on a remote Ubuntu Linux server (hosted on Slicehost). I would like to work on the source in an IDE on my Windows Vista PC, and have all file modifications sent directly to the Linux box without my intervention (i.e. without having to manually SFTP the files each time I change them). What is the very easiest way I can do this?
WinSCP includes a basic remote file editor, though if you want to use a proper IDE for your development this won't be much help.
I'd suggest you run a version control system like subversion, which would allow you to write a post-commit hook to automatically rsync your code the server with each commit.
Use PuTTy and SFTPDrive.
PuTTy is an SSH client, and SFTPDrive ($39 USD) will allow you to mount your remote file system locally as a drive letter.
Install Samba and OpenVPN on the server, and OpenVPN on the client. Setup Samba to share the directory tree you're interested in, and access it over the VPN for security. Perhaps Vista has non-sucky WebDAV support by now, and you could use WebDAV over HTTPS, but it was always crap under XP.
Ben's suggestion of a local dev environment using a VM is also a winner.
You could install cygwin and then have rsync run on cron every minute.
Or you could use Netdrive to access the server via FTP like a local disk:
http://tech.xptechsupport.com/netdrive-turn-your-ftp-into-a-drive-letter.html
Or you may be able to achieve something similar using cygwin and FUSE - you can on linux, but never tried it on cygwin.
Also, would it not be easier to set up a full dev environment locally? Maybe using a virtual machine? It'll be much quicker for testing. And then you can set up a shell script to transfer the current version to the slicehost server.

Resources