![]() Reload the systemd daemon to activate the changes # systemctl daemon-reloadīefore we do a reboot, let's just start the service and make sure if it is able to execute our script which will further create a directory under our shared folder /media/linux_dir # systemctl start access-shareĬheck the status of the service systemd service status for access-share From our previous article we know that RequiresMountsFor will check for the mount point and then start the respective service.Īdditionally target units will complement all configured dependencies of type Wants= or Requires= with dependencies of type After= unless DefaultDependencies=no is set in the specified units. Next we will create the service unit file which will execute our script during system startup. Sample script to execute at startup after shared folder is mounted This will be a simple script which just does some pre-checks and then creates a directory with timestamp into this shared folder. But for the sake of this article, let me create one ( /root/create_dir.sh). I assume you already have your script which you plan to execute at system startup or shutdown. ![]() Since everything is already configured, here is a snippet of the mounted share from my Linux VM:ĪLSO READ: How to Install Apr And Apr-Util in Linux Step-2. I have a shared folder D:\shared on my windows host which is to be mounted on /media/linux_dir ![]() I have already written a well descriptive article to create shared folder in VirtualBox, so I will not repeat the steps here. Configure Oracle VirtualBox shared folder Now this " Auto-Mount" feature, sounds cool right? Well turns out it has it's own pros and cons. Now this script will be executed as part of systemd service which will be configured to call the script only if our shared folder is in mounted state. We will create a script which is supposed to write some data into this shared folder when the VM node is coming up after reboot. The interesting part is VirtualBox also has a feature of " Auto-Mount" wherein it will mount this share on the VM automatically during reboot without any additional configuration required on the Linux client. I am using shared folder feature from Oracle VirtualBox which allows to share a folder from Windows Host to the Virtual Machine. ALSO READ: 20+ Top Open Source Application Performance Monitoring Tools (APM) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |