Rclone is the great tool to work with the cloud storage from various providers. While it works as service on Linux, you need to use interactive shell to make it work on Windows systems. There are different solutions which involve 3rd party tools to make it work as service but they do not provide the same flexibility as service can provide.
VirtIOGroove open sourced quick solution in C# how to make it work as service on Windows on github
It is quick workable draft, with plenty of space to improve — any suggestions are welcome!
Let us take a look what we need:
- Visual Studio (Community Edition works fine)
- .Net Framework 4.8
- Some patience to read this post to the end :)
Binary Installation, Configuration, Service Compilation and Creation
- Install software from steps 1 to 3 in previous section
rcloneand add path to folder where
rclonewas extracted to system
rclone configand configure cloud connection. Please see rclone documentation for details.
- Clone github repository
- Navigate to cloned github folder and import Solution to Visual Studio
- Example in Service1.cs covers mounting Azure blob storage using SAS — example assumes , that you already configured rclone to use Azure. You can configure
rclonewith different cloud provider and replace
protected override void OnStart(string args)
WriteToFile("Service started " + DateTime.Now);
timer.Elapsed += new ElapsedEventHandler(OnElapsedTime);
timer.Interval = 20000;
timer.Enabled = true;
var cParams = "mount blob:poc c:\\Azure";
string filename = "rclone.exe";
var proc = System.Diagnostics.Process.Start(filename, cParams);
WriteToFile("Can not start services");
- Once you are ok with parameters rebuild project.
- You can now use
c:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe- or whatever version you have from 4.x
Run services.msc and change Logon Account to user, under which you ran