Skip to content
operational 5.51 KiB
Newer Older
Yuanle Song's avatar
Yuanle Song committed
* COMMENT -*- mode: org -*-
#+Date: 2019-11-12
Time-stamp: <2019-11-12>
#+STARTUP: content
* notes                                                               :entry:
** 2019-11-12 docs
- rsync
  https://www.samba.org/ftp/rsync/rsync.html
- Basic Editing in Visual Studio Code
  https://code.visualstudio.com/docs/editor/codebasics

  Get Started with F# in Visual Studio Code | Microsoft Docs
  https://docs.microsoft.com/en-us/dotnet/fsharp/get-started/get-started-vscode
  install Ionide-fsharp extension.
- Argu
  http://fsprojects.github.io/Argu/
  Tutorial
  http://fsprojects.github.io/Argu/tutorial.html
  --help doesn't work, need error handler.
  Argu/Program.fs at master · fsprojects/Argu · GitHub
  https://github.com/fsprojects/Argu/blob/master/samples/Argu.Samples.LS/Program.fs
- F#
  F# Language Reference - F# | Microsoft Docs
  https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/
  F# Collection Types - F# | Microsoft Docs
  https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/fsharp-collection-types
  fsharp-cheatsheet
  https://dungpa.github.io/fsharp-cheatsheet/
  Literals - F# | Microsoft Docs
  https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/literals
  [|' '|] is an array of character, length is 1.
  F# list is not the same as array. You can convert array to list via Array.toList
  Environment.SpecialFolder
  https://docs.microsoft.com/en-us/dotnet/api/system.environment.specialfolder?view=netframework-4.8
  ApplicationData
  LocalApplicationData
  MyDocuments
  MyPictures
  DesktopDirectory
  Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
- 

Yuanle Song's avatar
Yuanle Song committed
* later                                                               :entry:
* current                                                             :entry:
** 
** 2019-11-12 make code work in a specific dir. then create an installer.
- install to %programfiles%
- config is saved to %appdata% roaming dir.
- on B75I3, rsync is here.
  D:\downloads\apps\rsync-w64-3.1.3-2-standalone\usr\bin\rsync.exe
  
  scheduled task command is:
  <Actions Context="Author">
    <Exec>
      <Command>D:\downloads\apps\rsync-w64-3.1.3-2-standalone\usr\bin\rsync.exe</Command>
      <Arguments>--stats -togr --chown=sylecn:sylecn --exclude-from=/cygdrive/d/sylecn_docs/texts/configs/rsync-exclude --files-from=/cygdrive/d/sylecn_docs/texts/configs/rsync-file-list --log-file=/cygdrive/d/sylecn_docs/rsync-b75i3.log -e ".\ssh.exe -F c:/users/sylecn/.ssh/config -i c:/Users/sylecn/.ssh/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" / sheni:/data/backup/server-backup/b75i3/</Arguments>
      <WorkingDirectory>D:\downloads\apps\rsync-w64-3.1.3-2-standalone\usr\bin\</WorkingDirectory>
    </Exec>
  </Actions>
- I don't want to bundle python with mbackup for windows, so I will use
  C# and dotnet core 3 to create mbackup console executable.
  
  mbackup --cron
  # run the command as if run in scheduled task.

  mbackup
  # run backup command interactively.
  
  create new console project.
  dotnet new console -lang=F#
  
  Try F# this time. it's said dotnet have very good F# support.
  It's a small program, should be easy to handle.
- implementation
  - install-package argu
    can't find package.
    https://www.nuget.org/packages/Argu
    try this:
    dotnet add package Argu --version 5.5.0
    it works.
  - how to change output exe file name?
    can't find it. won't fix. default name is mbackup-for-windows.dll/exe
  - make rsync command work.
  - how to backup only documents in "My Documents" and "Downloads"?
    I don't want to backup exe/msi/zip/rar/7z/iso/tar.gz files in those dir.
    Only backup pdf/docx/xlsx etc.

    Maybe just let user add "My Documents" in local.list.
    I won't backup anything by default.
    This is not good enough. docs should be backed up by default.

    can I backup a zip file if I have Documents/**.zip in exclude list?
  - TODO F# doesn't have a free logging framework yet?
    logary/LICENSE.md at master · logary/logary · GitHub
    https://github.com/logary/logary/blob/master/LICENSE.md
    this one is not free software.
  - 

Yuanle Song's avatar
Yuanle Song committed
** 2019-11-12 how to test it? test it in a win 10 VM?
- search: lite weight win 10 VM

  There are pirated specialized versions of Windows 7 and XP out there called
  TinyXP and Tiny7. They are very stripped down and light weight.

  Tiny7 is created using AIK.
  https://en.wikipedia.org/wiki/Windows_Automated_Installation_Kit
- try get tiny7 iso/disk image.
  tiny7 is no longer maintained.

  try the old version.
  Tiny 7 Windows : eXPreience : Free Download, Borrow, and Streaming : Internet Archive
  https://archive.org/details/Tiny7
  2017.5
- I have a 4.1G MSEdge win10 vmdk disk on sheni. from 2016.
  maybe just use this.
- there is no enough RAM on B75I3. I will stop bogon VM and run win 10 VM.
- 

** 2019-11-12 mbackup for windows
- features
  - windows installer.
    bundles mingw rsync and ssh.
    they are NOT installed to PATH. so it will not affect other ssh programs.
  - backup file list;
    user file list;
    default exclude file list;
    user exclude file list;
    etc
    They have different value compared to mbackup for linux.
  - script designed to run via windows scheduled task.
    no service installed. no auto starts.

    taskschd.msc

- implementation.
  - there is rsync running on B75I3.

    exported tasksched.msc config as xml.
    that XML is not portable.
    it contains hostname.
  - 
* done                                                                :entry:
* wontfix                                                             :entry: