[GH-ISSUE #525] Scheduled task only runs when on AC #290

Closed
opened 2026-02-27 15:49:43 +03:00 by kerem · 3 comments
Owner

Originally created by @GodsVictory on GitHub (Sep 7, 2016).
Original GitHub issue: https://github.com/quasar/Quasar/issues/525

This is fine for desktops, but when a laptop is ran on battery, the client will not startup.

There are 2 alternatives that I have found:

  1. Create a XML file when building the clients containing the scheduled task

  2. Use a windows service instead

I posted a solution to creating windows services on an old post. It replaces the schtasks command in startup.cs with this:

ProcessStartInfo startInfo = new ProcessStartInfo("sc")
{
    Arguments = "create \"" + Settings.STARTUPKEY + "\" binpath= \"" + ClientData.CurrentPath + "\" start= auto",
    UseShellExecute = false,
    CreateNoWindow = true
};

Process p = Process.Start(startInfo);
p.WaitForExit(1000);
if (p.ExitCode == 0) return true;

Edit: The service does not currently work correctly. Windows waits for a "Service Started" message within 30 seconds of starting the service. I will see if I can figure out how to implement ServiceMain to support it.

Originally created by @GodsVictory on GitHub (Sep 7, 2016). Original GitHub issue: https://github.com/quasar/Quasar/issues/525 This is fine for desktops, but when a laptop is ran on battery, the client will not startup. There are 2 alternatives that I have found: 1) Create a XML file when building the clients containing the scheduled task 2) Use a windows service instead I posted a solution to creating windows services on an old post. It replaces the schtasks command in startup.cs with this: ``` ProcessStartInfo startInfo = new ProcessStartInfo("sc") { Arguments = "create \"" + Settings.STARTUPKEY + "\" binpath= \"" + ClientData.CurrentPath + "\" start= auto", UseShellExecute = false, CreateNoWindow = true }; Process p = Process.Start(startInfo); p.WaitForExit(1000); if (p.ExitCode == 0) return true; ``` Edit: The service does not currently work correctly. Windows waits for a "Service Started" message within 30 seconds of starting the service. I will see if I can figure out how to implement ServiceMain to support it.
kerem closed this issue 2026-02-27 15:49:43 +03:00
Author
Owner

@dummy0stud commented on GitHub (Sep 9, 2016):

"but when a laptop is ran on battery", are you sure about this?

<!-- gh-comment-id:245980686 --> @dummy0stud commented on GitHub (Sep 9, 2016): "but when a laptop is ran on battery", are you sure about this?
Author
Owner

@GodsVictory commented on GitHub (Sep 12, 2016):

yes?

<!-- gh-comment-id:246351788 --> @GodsVictory commented on GitHub (Sep 12, 2016): yes?
Author
Owner

@MaxXor commented on GitHub (Sep 15, 2016):

This belongs to #244 second point:

Add ability to install Client as Windows Service

<!-- gh-comment-id:247335965 --> @MaxXor commented on GitHub (Sep 15, 2016): This belongs to #244 second point: > Add ability to install Client as Windows Service
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Quasar#290
No description provided.