📜 ⬆️ ⬇️

Google Chrome and RamDisk. Automation, backup and auto-update

After reading the article Wean Chrome to eat hard drives , I had an idea to use ramdisk not only for Chrome, but also for many other frequently launched applications (WinRAR, Miranda, Firefox, web server, etc.).

I took the idea and was very pleased with the increased speed of my laptop (1000 MB / s versus 35 MB / s!). The only thing that was required was to make an automatic backup of the changed files on the ramdisk.

For this purpose, I decided to use nnCron. After reading the forums and all kinds of help, I wrote several scripts that automate all the routine associated with the work of applications on the ramdisk.
')
In this article I will only address the Chrome browser.

So, use Chrome on ramdisk .

What do we need for this?
1) Startup Chrome on ramdisk at system startup
2) Auto backup to hard disk when closing Chrome
3) Auto Backup every hour
4) Auto-update browser from the Internet

We will need:
nnCron , nnBackup (be sure to register!), WinRAR , Gavotte Ramdisk , Wget , more RAM.

First install all these programs. Create a ramdisk R: \.

Then unpack the Chrome distribution in D: \ BackUp \ Programs \ Chromium \ Chrome on the hard disk.
We create a shortcut to the executable file chrome.exe, in which we additionally indicate in the field “Object”: “R: \ Programs \ Chromium \ Chrome \ chrome.exe - user-data-dir = .. \ Profile - enable-user- scripts ”, and in the“ Working folder ”field:“ R: \ Programs \ Chromium \ Chrome ”(all without quotes).
The shortcut is placed on the desktop and / or in the quick launch panel, in the future we will launch them with a browser.

In summary, how things should work:
When a user logs in, nnCron will upload Chrome along with a profile from the D: \ BackUp \ Programs \ Chromium folder to the ramdisk in the R: \ Programs folder. Chrome will work with ramdisk. The backup will be incremental, in D: \ BackUp.

The first script:

#( BIG_START
AsLoggedUser
SingleInstance
WatchLogon: "*"
Action:
SWHide
AsService
StartIn: "R:\Programs\nnBackup\"
START-APPW: R:\Programs\nnBackup\nnbackup.exe sync -i D:\BackUp\Programs\Chromium -o R:\Programs\Chromium -s -c -x chrome.exe -dx cache
START-APP: R:\Programs\nnBackup\nnbackup.exe sync -i D:\BackUp\Programs\Chromium\Chrome -o R:\Programs\Chromium\Chrome -c -m chrome.exe
START-APP: R:\Programs\nnBackup\nnbackup.exe sync -i D:\BackUp\Programs\Chromium\Profile\Default\Cache -o R:\Programs\Chromium\Profile\Default\Cache -c
)#


Everything is very simple: a) a folder with Chrome and a profile is loaded onto the ramdisk, without an executable file and cache; b) the executable file itself is loaded. This is done in order not to run chrome, until all files are completely copied; c) the cache is loaded at the end. It is copied for a long time, and we have no reason to wait. You can immediately open the pages in the Internet, the cache will load in a minute or two.

One more thing: if we logged out and logged in again, then Chrome will not be re-loaded on ramdisk, which will save time.

The following script backs up profile files when Chrome closes. Incremental backup, i.e. Only modified and new files will be backed up:

#( BackUp_Chromium
AsLoggedUser
SingleInstance
WatchProcStop: "chrome.exe"
Rule: PROC-EXIST: "chrome.exe" NOT
Action:
SWHide IdlePriority
AsService
StartIn: "R:\Programs\nnBackup\"
START-APP: R:\Programs\nnBackup\nnbackup.exe sync -i R:\Programs\Chromium -o D:\BackUp\Programs\Chromium -s -ad -c -m "Bookmarks,Cookies,Current*,Extension Cookies,History,Last*,Preferences,Thumbnails,Visited Links,Web Data,*.bdic,Local State,Safe Br*,Chrome\Plugins\*.dll"
START-APPW: R:\Programs\nnBackup\nnbackup.exe sync -i R:\Programs\Chromium\Profile\Default -o D:\BackUp\Programs\Chromium\Profile\Default -s -ad -da -c -m "Cached Theme Images\*,Extensions\*,JumpListIcons*\*,User scripts\*"
START-APP: R:\Programs\nnBackup\nnbackup.exe sync -i R:\Programs\Chromium\Profile\Default\Cache -o D:\BackUp\Programs\Chromium\Profile\Default\Cache -ad -da -c
)#


Another script that backs up Chrome every hour on the screw:

#( BackUp_One_Hour
AsLoggedUser
SingleInstance
Time: 0 * * * * *
Action:
SWHide IdlePriority
AsService
StartIn: "R:\Programs\nnBackup\"
START-APP: R:\Programs\nnBackup\nnbackup.exe sync -i R:\Programs -o D:\BackUp\Programs -s -ad -c -m "Bookmarks,Cookies,Current*,Extension Cookies,History,Last*,Preferences,Thumbnails,Visited Links,Web Data,*.bdic,Local State,Safe Br*,Chromium\Chrome\Plugins\*"
START-APPW: R:\Programs\nnBackup\nnbackup.exe sync -i R:\Programs -o D:\BackUp\Programs -s -ad -da -c -m "Chromium\*\Cached Theme Images\*,Chromium\*\Extensions\*,Chromium\*\JumpListIcons*\*,Chromium\*\User scripts\*"
START-APP: R:\Programs\nnBackup\nnbackup.exe sync -i R:\Programs\Chromium\Profile\Default\Cache -o D:\BackUp\Programs\Chromium\Profile\Default\Cache -ad -da -c
)#


And the last script that updates Chrome twice a week:

#( Update_Chromium
AsLoggedUser
SingleInstance
Time: 0 21 * * 3,7 *
Action:
SWHide IdlePriority
AsService
StartIn: "D:\BackUp\Wget\"
DIR-DELETE: "R:\Updates\Chromium"
START-APPW: D:\BackUp\Wget\wget.exe build.chromium.org/buildbot/continuous/LATEST/chrome-win32.zip -PR:\Updates\Chromium\ -c --limit-rate=32k --wait=2m --tries=60
FILE-EXIST: "R:\Updates\Chromium\chrome-win32.zip" NOT
IF
LOG: "D:\BackUp\Programs\update.log" " chrome-win32.zip [%FT-CUR FT>DD.MM.YYYY/hh:mm:ss%]"
EXIT
THEN
START-APPW: R:\Programs\WinRAR\WinRAR.exe t R:\Updates\Chromium\chrome-win32.zip -r -y
ExitCodeProc 0 <>
IF
LOG: "D:\BackUp\Programs\update.log" " chrome-win32.zip [%FT-CUR FT>DD.MM.YYYY/hh:mm:ss%]"
EXIT
THEN
START-APPW: R:\Programs\WinRAR\WinRAR.exe x R:\Updates\Chromium\chrome-win32.zip R:\Updates\Chromium\ -y
ExitCodeProc 0 <>
IF
LOG: "D:\BackUp\Programs\update.log" " chrome-win32.zip [%FT-CUR FT>DD.MM.YYYY/hh:mm:ss%]"
EXIT
THEN
PAUSE: 10000

START-APPW: R:\Programs\nnBackup\nnbackup.exe sync -i R:\Updates\Chromium\chrome-win32 -o D:\BackUp\Programs\Chromium\Chrome -s -ad -da -c -dx Dictionaries,locales,Plugins,resources
START-APPW: R:\Programs\nnBackup\nnbackup.exe -i R:\Updates\Chromium\chrome-win32\locales\ru.dll -o D:\BackUp\Programs\Chromium\Chrome\locales -c
LOG: "D:\BackUp\Programs\update.log" "chrome-win32.zip [%FT-CUR FT>DD.MM.YYYY/hh:mm:ss%]"

BEGIN PAUSE: 500 PROC-EXIST: "chrome.exe" NOT UNTIL
BEGIN FILE-DELETE: "R:\Programs\Chromium\Chrome\chrome.exe" PAUSE: 1000 FILE-EXIST: "R:\Programs\Chromium\Chrome\chrome.exe" NOT UNTIL

START-APPW: R:\Programs\nnBackup\nnbackup.exe sync -i R:\Updates\Chromium\chrome-win32 -o R:\Programs\Chromium\Chrome -s -ad -da -c -x chrome.exe -dx Dictionaries,locales,Plugins,resources
START-APPW: R:\Programs\nnBackup\nnbackup.exe -i R:\Updates\Chromium\chrome-win32 -o R:\Programs\Chromium\Chrome -s -c -m chrome.exe,locales\ru.dll
DIR-DELETE: "R:\Updates\Chromium"
)#


The update works like this:
A new archive is downloaded, checked, unpacked. Files in a backup with saving of plug-ins and dictionaries are updated.
If Chrome is currently running, the script waits until the browser is closed, and then updates the files on the ramdisk.

That's all!
Edit the path to run programs in the scripts for themselves.

Source: https://habr.com/ru/post/70926/


All Articles