-
-
Notifications
You must be signed in to change notification settings - Fork 52
Use schtasks.exe CLI to schedule jobs on Windows #459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
23782cf
try using a fork of the taskmaster library
creativeprojects 8cd6610
typos
creativeprojects 2e528af
save xml examples
creativeprojects 1ad8b92
add example files
creativeprojects 7736123
starting work on loading/saving task scheduler XML files
creativeprojects 7570073
more tests on reading/writing task scheduler XML definition
creativeprojects 872472c
formal xml files
creativeprojects 8ea0cd9
start loading/saving triggers
creativeprojects 765a565
daily triggers
creativeprojects cf50ed1
generate weekdays schedules
creativeprojects 6d2a964
add monthly triggers
creativeprojects 7e98423
add integration tests creating and reading task scheduler
creativeprojects 0ef4b9b
small cleanup
creativeprojects 6e3ac46
refactoring allowing keeping taskmaster library behind a build tag
creativeprojects d2ddd47
display status & delete task
creativeprojects 19b6a7f
create tasks using system account
creativeprojects 927a302
add information about security descriptor string
creativeprojects 17fa7b6
small refactoring
creativeprojects bca145b
Merge branch 'taskmaster-library-2' into taskmaster-library
creativeprojects 01c84ee
cleaning up
creativeprojects 280ab1c
moving code around
creativeprojects f422385
refactoring
creativeprojects 3de3177
make schtasks package windows only
creativeprojects 18ff115
add more tests
creativeprojects 67970d7
simplification
creativeprojects File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,3 +41,4 @@ go.work | |
| go.work.sum | ||
|
|
||
| /*.txt | ||
| output.xml | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| //go:build windows | ||
|
|
||
| package schtasks | ||
|
|
||
| type Actions struct { | ||
| Context string `xml:"Context,attr"` | ||
| Exec []ExecAction `xml:"Exec"` | ||
| } | ||
|
|
||
| type ExecAction struct { | ||
| Command string `xml:"Command"` | ||
| Arguments string `xml:"Arguments"` | ||
| WorkingDirectory string `xml:"WorkingDirectory,omitempty"` | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| //go:build windows | ||
|
|
||
| package schtasks | ||
|
|
||
| type Config struct { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| //go:build windows | ||
|
|
||
| package schtasks | ||
|
|
||
| const ( | ||
| dateFormat = "2006-01-02T15:04:05-07:00" | ||
| maxTriggers = 60 | ||
| author = "Author" | ||
| taskSchema = "http://schemas.microsoft.com/windows/2004/02/mit/task" | ||
| taskSchemaVersion = "1.4" | ||
| defaultPriority = 8 | ||
| binaryPath = "schtasks.exe" | ||
| tasksPathPrefix = `\resticprofile backup\` | ||
| // From: https://learn.microsoft.com/en-us/windows/win32/secauthz/security-descriptor-string-format | ||
| // O:owner_sid | ||
| // G:group_sid | ||
| // D:dacl_flags(string_ace1)(string_ace2)... (string_acen) <--- | ||
| // S:sacl_flags(string_ace1)(string_ace2)... (string_acen) | ||
| // With flag: | ||
| // "AI" SDDL_AUTO_INHERITED | ||
| // From: https://learn.microsoft.com/en-us/windows/win32/secauthz/ace-strings | ||
| // - first field: | ||
| // "A" SDDL_ACCESS_ALLOWED | ||
| // - third field | ||
| // "FA" SDDL_FILE_ALL FILE_GENERIC_ALL | ||
| // "FR" SDDL_FILE_READ FILE_GENERIC_READ | ||
| // "FW" SDDL_FILE_WRITE FILE_GENERIC_WRITE | ||
| // "FX" SDDL_FILE_EXECUTE FILE_GENERIC_EXECUTE | ||
| // From: https://learn.microsoft.com/en-us/windows/win32/secauthz/sid-strings | ||
| // "AU" SDDL_AUTHENTICATED_USERS | ||
| // "BA" SDDL_BUILTIN_ADMINISTRATORS | ||
| // "LS" SDDL_LOCAL_SERVICE | ||
| // "SY" SDDL_LOCAL_SYSTEM | ||
| securityDescriptor = "D:AI(A;;FA;;;BA)(A;;FA;;;SY)(A;;FRFX;;;LS)(A;;FR;;;AU)" | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.