Skip to content

Instantly share code, notes, and snippets.

@sarkrui
Last active February 23, 2023 09:48
Show Gist options
  • Save sarkrui/cb3e8a879b200738a75f8190509aee14 to your computer and use it in GitHub Desktop.
Save sarkrui/cb3e8a879b200738a75f8190509aee14 to your computer and use it in GitHub Desktop.

Revisions

  1. Sark revised this gist Aug 14, 2020. No changes.
  2. Sark revised this gist Jul 27, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion setWXBackupCron.sh
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    mkdir ~/.scripts

    #wget backup script
    wget --no-check-certificate -P https://gist.github.com/sarkrui/cb3e8a879b200738a75f8190509aee14/raw/WeChat_backup.sh
    wget --no-check-certificate https://gist.github.com/sarkrui/cb3e8a879b200738a75f8190509aee14/raw/WeChat_backup.sh
    #making it execuatable
    chmod +x WeChat_backup.sh

  3. Sark revised this gist Jul 21, 2020. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions setWXBackupCron.sh
    Original file line number Diff line number Diff line change
    @@ -4,8 +4,7 @@
    mkdir ~/.scripts

    #wget backup script
    wget --no-check-certificate -P ~/.scripts/ https://gist.github.com/sarkrui/cb3e8a879b200738a75f8190509aee14/raw/e68ccee31e213155f857d71e40cf71e8185cfa0c/WeChat_backup.sh

    wget --no-check-certificate -P https://gist.github.com/sarkrui/cb3e8a879b200738a75f8190509aee14/raw/WeChat_backup.sh
    #making it execuatable
    chmod +x WeChat_backup.sh

  4. Sark revised this gist Jul 7, 2020. No changes.
  5. Sark renamed this gist Jun 5, 2020. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  6. Sark revised this gist Jun 5, 2020. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions setCrontab.sh
    Original file line number Diff line number Diff line change
    @@ -20,5 +20,6 @@ echo "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\n*/~/.sc
    #install new cron file
    crontab mycron
    rm mycron
    echo "Crontab schedule created!"


  7. Sark revised this gist Jun 5, 2020. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions setCrontab.sh
    Original file line number Diff line number Diff line change
    @@ -13,8 +13,9 @@ chmod +x WeChat_backup.sh
    crontab -l > mycron
    #echo new cron into cron file

    # 30 1 * * * crontab = Scheduled at evryday at 01:30
    echo "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\n*/30 1 * * * cd ~/.scripts && ./test.sh" >> mycron
    # 0 2 * * * crontab = Scheduled at evryday at 01:30
    # 2>&1 indicates that the standard error (2>) is redirected to the same file descriptor that is pointed by standard output (&1).
    echo "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\n*/~/.scripts && ./WeChat_backup.sh > ~/.scripts/log/WeChat_backup.log 2>&1" >> mycron

    #install new cron file
    crontab mycron
  8. Sark revised this gist Jun 5, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion setCrontab.sh
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@ chmod +x WeChat_backup.sh
    crontab -l > mycron
    #echo new cron into cron file

    #30 1 * * * crontab = Scheduled at evryday at 01:30
    # 30 1 * * * crontab = Scheduled at evryday at 01:30
    echo "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\n*/30 1 * * * cd ~/.scripts && ./test.sh" >> mycron

    #install new cron file
  9. Sark revised this gist Jun 5, 2020. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion setCrontab.sh
    Original file line number Diff line number Diff line change
    @@ -12,7 +12,9 @@ chmod +x WeChat_backup.sh
    #write out current crontab
    crontab -l > mycron
    #echo new cron into cron file
    echo "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\n*/1 * * * * cd ~/.scripts && ./test.sh" >> mycron

    #30 1 * * * crontab = Scheduled at evryday at 01:30
    echo "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\n*/30 1 * * * cd ~/.scripts && ./test.sh" >> mycron

    #install new cron file
    crontab mycron
  10. Sark revised this gist Jun 5, 2020. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion setCrontab.sh
    Original file line number Diff line number Diff line change
    @@ -12,9 +12,10 @@ chmod +x WeChat_backup.sh
    #write out current crontab
    crontab -l > mycron
    #echo new cron into cron file
    echo "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \n */1 * * * * cd ~/.scripts && ./test.sh" >> mycron
    echo "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\n*/1 * * * * cd ~/.scripts && ./test.sh" >> mycron

    #install new cron file
    crontab mycron
    rm mycron


  11. Sark revised this gist Jun 5, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion setCrontab.sh
    Original file line number Diff line number Diff line change
    @@ -12,7 +12,7 @@ chmod +x WeChat_backup.sh
    #write out current crontab
    crontab -l > mycron
    #echo new cron into cron file
    echo "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \n */1 * * * * cd /Users/p.xing/.scripts && ./test.sh" >> mycron
    echo "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \n */1 * * * * cd ~/.scripts && ./test.sh" >> mycron

    #install new cron file
    crontab mycron
  12. Sark revised this gist Jun 5, 2020. 2 changed files with 21 additions and 1 deletion.
    2 changes: 1 addition & 1 deletion WeChat_backup.command → WeChat_backup.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    #! /bin/bash
    #!/bin/bash

    #change working directory to Desktop
    cd ~/Desktop
    20 changes: 20 additions & 0 deletions setCrontab.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    #!/bin/bash

    #I usually put bash scripts under this folder
    mkdir ~/.scripts

    #wget backup script
    wget --no-check-certificate -P ~/.scripts/ https://gist.github.com/sarkrui/cb3e8a879b200738a75f8190509aee14/raw/e68ccee31e213155f857d71e40cf71e8185cfa0c/WeChat_backup.sh

    #making it execuatable
    chmod +x WeChat_backup.sh

    #write out current crontab
    crontab -l > mycron
    #echo new cron into cron file
    echo "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \n */1 * * * * cd /Users/p.xing/.scripts && ./test.sh" >> mycron

    #install new cron file
    crontab mycron
    rm mycron

  13. Sark revised this gist May 28, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion WeChat_backup.command
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ cd ~/Desktop
    rm -f WeChat_history*

    # generate the new updated
    tar -vczf ~/Desktop/WeChat_history$(date +%F_%R).tgz /Users/p.xing/Library/Containers/com.tencent.xinWeChat/Data/Library/Application\ Support/com.tencent.xinWeChat
    tar -vczf ~/Desktop/WeChat_history$(date +%F_%R).tgz ~/Library/Containers/com.tencent.xinWeChat/Data/Library/Application\ Support/com.tencent.xinWeChat

    # shall config rclone at the first place
    # push to Google Drive name Team, (Google Team Drive has 5T storage)
  14. Sark renamed this gist May 26, 2020. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  15. Sark created this gist May 20, 2020.
    20 changes: 20 additions & 0 deletions WeChat_backup.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    #! /bin/bash

    #change working directory to Desktop
    cd ~/Desktop

    # remove any previously existing compressed files
    rm -f WeChat_history*

    # generate the new updated
    tar -vczf ~/Desktop/WeChat_history$(date +%F_%R).tgz /Users/p.xing/Library/Containers/com.tencent.xinWeChat/Data/Library/Application\ Support/com.tencent.xinWeChat

    # shall config rclone at the first place
    # push to Google Drive name Team, (Google Team Drive has 5T storage)
    # under the root (/) directory,
    # and shows progress by -P
    rclone sync ~/Desktop/WeChat_history* Team:/ -P

    echo "Done!"