App as service default path

App as service default path

Postby TimStone » Tue Jul 30, 2019 8:57 pm

I have an update program called. MLupdate.exe. I place it in the primary directory created for my application ( ie. c:\ML ). This has a subdirectory where all files are stored ( ie. C:\ML\Data\ ).

When run as an application, it checks the current drive and directory and creates a cPath variable that points to the data file.

When run as a service, Windows has it start in the System32 folder, even though that is not where it physically resides, and it can't find the data files.

I could probably put a configuration file in the System32 folder to be read by the service, but the main problem is the actual installed location of the data directory can be different. For example, on some servers it might be N:\Shared\ML\Data\. I could create and configure this manually on each install, but prefer to do it with the installer ( Actual Installer ).

The easiest solution would be to get the service to know where it's file is located, and set it's path accordingly.

Any suggestions on to get this accomplished within the service startup code ?

Thanks.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: App as service default path

Postby TimStone » Thu Aug 01, 2019 4:42 pm

Is no one using FWH / Harbour to build a Windows service ? I would think someone must have encountered this issue.

The main problem is that a 24/7 app used to perform daily tasks automatically, if installed on Windows Server, will not run unless someone actually logs into the server. The way around this is to install a service. I got one built, and running, but had to hardcode a path since it sets it's root as the System/Windows32 folder even when installed elsewhere.

Surely someone has ideas on this.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 49 guests