From deb7f5e34cabbb6b80a3636ae74028d4166129e9 Mon Sep 17 00:00:00 2001 From: Yuanle Song Date: Sat, 16 Nov 2019 23:26:25 +0800 Subject: [PATCH] install scheduled tasks when installing. --- mbackup.fsproj | 2 +- mbackup.wxs | 38 +++++++++++++++++++++++--- operational | 72 ++++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 106 insertions(+), 6 deletions(-) diff --git a/mbackup.fsproj b/mbackup.fsproj index 7855622..3de10da 100644 --- a/mbackup.fsproj +++ b/mbackup.fsproj @@ -6,7 +6,7 @@ win10-x64 Mbackup true - 0.3.0.0 + 0.4.5.0 diff --git a/mbackup.wxs b/mbackup.wxs index 14aac2b..fdc2ea0 100644 --- a/mbackup.wxs +++ b/mbackup.wxs @@ -1,7 +1,7 @@ - + @@ -50,7 +50,7 @@ Description="Backup your computer using rsync" Target="[!filE3FFB5E42FD6DDB7AD945F29409779F0]" WorkingDirectory="MBACKUP_PROGRAM_FILES"/> - + @@ -77,11 +77,43 @@ Description="mbackup local-exclude.txt file" Target="[!local_exclude.txt]" WorkingDirectory="MBACKUP_PROGRAM_FILES"/> - + + + NOT Installed + Installed + NOT Installed + Installed + + + + + + + diff --git a/operational b/operational index c9dab56..a94acb1 100644 --- a/operational +++ b/operational @@ -91,6 +91,8 @@ dotnet run -- -i https://www.firegiant.com/wix/tutorial/getting-started/ Then you can follow the how-tos. + How To Guides + https://wixtoolset.org/documentation/manual/v3/howtos/ How To: Implement a Major Upgrade In Your Installer https://wixtoolset.org/documentation/manual/v3/howtos/updates/major_upgrade.html @@ -105,6 +107,9 @@ dotnet run -- -i https://docs.microsoft.com/en-us/windows/win32/msi/ice90 https://docs.microsoft.com/en-us/windows/win32/msi/ice69 + CustomAction Element + https://wixtoolset.org/documentation/manual/v3/xsd/wix/customaction.html + ** 2019-11-13 install dir layout. C:\Program Files\mbackup\rsync-w64\usr\bin\rsync.exe C:\Program Files\mbackup\rsync-w64\usr\bin\ssh.exe @@ -221,6 +226,9 @@ vscode should at least always indent using space for F#. * current :entry: ** +** 2019-11-16 how to sign my msi executable? +so it doesn't show publisher unknown. + ** 2019-11-12 make code work in a specific dir. then create an installer. - bundle dotnet core 3 with installer. - DONE install binary files to %programfiles% @@ -229,9 +237,9 @@ vscode should at least always indent using space for F#. SCHTASKS /Create /? # run mbackup 15m after user logon. - SCHTASKS /Create /NP /SC ONLOGON /TN mbackup-logon /TR "\"\" \"args\"" /DELAY 15:00 + SCHTASKS /Create /NP /SC ONLOGON /TN mbackup-logon /TR "\"\" \"args\"" /DELAY 0015:00 # run mbackup at 10am and 4pm. - SCHTASKS /Create /NP /SC DAILY /TN mbackup-morning /TR "\"\" \"args\"" /ST 10:00 /ET 13:00 /K + SCHTASKS /Create /NP /SC DAILY /TN mbackup-morning /TR "\"\" \"args\"" /ST 10:00 /ET 14:00 /K SCHTASKS /Create /NP /SC DAILY /TN mbackup-afternoon /TR "\"\" \"args\"" /ST 16:00 /ET 19:00 /K # debug purpose, one time only @@ -304,6 +312,66 @@ vscode should at least always indent using space for F#. logary/LICENSE.md at master · logary/logary · GitHub https://github.com/logary/logary/blob/master/LICENSE.md this one is not free software. + - 2019-11-16 create scheduled task fail when installing. + how to check the output of the command? + msiexec /l*v log.txt /i mbackup-0.4.0.0.msi + only log error + msiexec /le loge.txt /i mbackup-0.4.0.0.msi + + it's mbackup.exe path problem. + [INSTALLFOLDER] expands to empty string. + + [INSTALLFOLDER]\publish\mbackup.exe + --> + [MBACKUP_PROGRAM_FILES]publish\mbackup.exe + - after this change, command runs fine in admin cmd.exe window. + but when run in installer, still fail. + - "[SystemFolder]SCHTASKS.EXE" + --> + SCHTASKS.EXE + same error. not escaping issue. + - error 1722 from simplest of .exe custom actions - Community + https://community.flexera.com/t5/InstallShield-Forum/error-1722-from-simplest-of-exe-custom-actions/td-p/66380 + + notepad.exe works in my case. + when I exit notepad.exe, installer exit successfully. + does it run as admin user? check. + + it's run as system user. not administrator or current user. + it can't access desktop/documents etc. + maybe that's the reason? + + » Using Windows Installer (WIX) to schedule a task as the system user RainbowInWater + http://kamivaniea.com/?p=632 + + SCHTASKS.EXE /Create /RU SYSTEM /RP /NP /SC ONLOGON /TN mbackup-logon /TR "C:\Program Files\mbackup\publish\mbackup.exe" /DELAY 0015:00 + + - try add /RU SYSTEM /RP + it works. + + TODO task will run as SYSTEM user though. + how would home dir expand in SYSTEM user? + I'd like task to run as currently logon user. for ONLOGON. + + - TODO why start menu shortcuts doesn't appear in win 10 guest? + start menu folder is created. but only one exe there. + txt file shortcuts are not added. + + - DAILY trigger, why repeat every 10min? + + #+BEGIN_QUOTE + /RI interval Specifies the repetition interval in minutes. This is + not applicable for schedule types: MINUTE, HOURLY, + ONSTART, ONLOGON, ONIDLE, ONEVENT. + Valid range: 1 - 599940 minutes. + If either /ET or /DU is specified, then it defaults to + 10 minutes. + #+END_QUOTE + just remove /ET? /K requires /ET. + + I can make use of /RI, run mbackup every 30min. + TODO what happen if last run have not finished yet? + does /RI interval count from last exit? - ** 2019-11-12 how to test it? test it in a win 10 VM? -- GitLab