Home / GitHub Page

Schedule automatic Windows backup?

Well, I have mostly moved over to Joplin after 10 years of using Evernote. Their lack of innovation, awful editor, toxic forum atmosphere and increasingly steep price hikes are the main reasons. Joplin does almost everything I would want it to and in many cases, actually better than Evernote, which is an INCREDIBLE feat considering Evernote is a decade older and had HUNDREDS of employees working on it. Hats off to @laurent - my utmost respect.

However, since the app is meant to keep my “life’s memories” forever, I need a little failsafe :slight_smile: For example, I had a note that contained some images and text. I wanted to edit the note on my Android… but then accidentally removed too much text plus part of the code that contained an image. To my horror it auto saved immediately after - and no way to undo my edit.
I actually managed to correct this by quickly running to my desktop, copying the original note, wait for the sync to finish, then paste the note to the version before the Android edit.

That got me thinking though - I really, REALLY need to create a daily backup process. I have exported my entire environment to a JEX file (5+GB), but I don’t want to do this daily. Is there a Windows feature that can do this automatically?

I searched this forum and found a cron script that works on Linux, but I’m using Joplin on Windows and Android and sync through Dropbox… is there a similar script/method that would create a backup on Windows?

Thanks and once again, big thumbs up on what has been accomplished with Joplin, I’m really impressed with the features and overal stability and really look forward to make it my daily driver!

2 Likes

Yep, autosave without undo is really dangerous. I wished there was either the possibility to turn off auto-save or undo edits.

However, note history might help with this. The problem is that one can’t control the heuristic when a new new note history is created, so one might hit a situation where the data is just gone.
I hope we’ll find a solution to mitigate this issue.

I’m not a Windows person, but I was told that Windows now has a Linux subsystem. But even if this is not an option, it should also be possible to put these commands in a bat file.
There are a lot of Windows users in this forum, so the chances are high that you will get a proper answer.

2 Likes

Re note history: thanks, I never even thought of using that - but that is just a desktop feature, right? I didn’t see anything like it on my Note. Still, good to know, I’ll try that next time (hopefully there isn’t a next time though, haha).

As for the Windows export/backup feature: look forward to hearing suggestions!

Side question: would it be similar to a backup to create a copy of the Dropbox encrypted files in ./apps/Joplin (that might be easier in fact), or do I really need to export the files in JEX format from the app itself?

There’s currently no easy way to auto backup the notes.

What kind of feature would you expect for example? Just a JEX file being auto-exported every day? But it means 5GB of used space everyday, so you’ll run out of space quickly, or do you have something else in mind?

Thanks laurent :slight_smile: I haven’t given it any deep thought yet, but I read quite a few topics in this forum and it seems that having your data just in Dropbox is not equal to having a proper backup - Dropbox is meant for syncing only.

If I were to picture an export feature, I’d probably choose something that deletes the oldest version after x days so you only have one week’s worth of backups.

It could also be that I’m overthinking this way too much :smiley: What if I just use a 3rd party backup program to create a copy of the encrypted Dropbox files, or the files in my Windows user directory?

I sync my notes by my owne server. I create some server on Ubuntu on my VPS, then install Nginx HTTP server, then create WebDAV module with auth. Now my 2 laptops and iPhone syncing by this WebDAV server. On my server working cron and make diff backup of WebDAV direcotry by rsync every night. All on my servers, full privacy and secure. Ofc. backup is copy to some another servers by scp.



https://help.ubuntu.com/community/CronHowto
https://linux.die.net/man/1/scp

Wow, that looks quite impressive - amazing what people can do with Joplin :slight_smile: Unfortunately I am using it mostly on Windows, and I’m afraid most of what you said there is way above my head :smiley: (I blame that on my lack of knowledge, not on your skills, haha).

Yes there are various ways to auto backup Joplin’s data, but no built-in one at the moment. I wonder if there’s some package or something we could use to handle incremental backups for the app.

1 Like

That would be lovely, but honestly, you don’t have to go through a lot of hoops on my behalf :slight_smile:

Joplin has been rock solid since I started getting serious with it (about a week ago) including the syncing. In all honesty I think that the-app-which-shall-not-be-named-but-let’s-call-it-Evernote lost more notes than Joplin ever will :smiley:

It’s actually a topic that often comes back, how to backup Joplin’s data, so it would be good to find a solution in any case :slight_smile:

Ideally it would be something enabled by default and that auto backup, that way when someone loses a note for any reason, we can point to that auto backup.

3 Likes

Well, if that could be done, it would certainly be the best of all worlds. Incremental backups would indeed be best, but honestly if it just exports the notes at regular intervals that would be great too. I’ll patiently await whatever you may (or may not) come up with :smiley:

2 Likes

@laurent , isn’t copying resources folder and database.sqlite are enough to restore everything in Windows Joplin?

Why backup the client data? On the server, just write a simple 1 line script to rsync Joplin files to an external backup every X minutes via cron. This effectively keeps a synced backup on another drive.

Restore all Joplin notes with a single line script.

joplin.bu.sh:
backup Joplin notes files to external drive
rsync -av --delete /path/to/joplin/files/.joplin/ /path/to/external/drive/joplin

joplin.restore.sh
restore ( just reverse the above )
rsync -av --delete /path/to/external/drive/joplin /path/to/joplin/files/.joplin/

I.E. Add cron job to do this every 15 mins between the hours of 9am and 11pm. (No need to run it during sleep hours since the data is not changing at this time)
Cron: ( writes it to log file so one can see what it’s doing )
*/5 9-23 * * * /bin/bash/joplin.bu.sh > joplin.bu.log 2>&1

But how would that work on Windows for users who sync through Dropbox?

I think I would prefer something that creates a backup from the Windows app itself (either client or server side, I don’t mind) but I know how busy @laurent is so I just create a backup manually every few days for now :slight_smile:

Yes, but make sure you also backup database.sqlite-journal or you might miss some data.

The issue with backing up the sqlite database is that you cannot restore just one note - it’s all of nothing. With JEX, you can import the file, view the notes and notebooks and keep only what you’re interested in.

1 Like

It’s probably a matter of preference. Your method would definitely work but personally I generally prefer to have my data locally.

However the main issue in this thread is to potentially have a zero-config auto backup in Joplin. Something that just works without having to setup anything, and if we do this that would indeed be client side.

1 Like

I made a workaround in autohotkey (create a JEX backup every 60mins).

  • it will start joplin if it’s not already running, save the jex (into the last used dir) automatically with date and time.
  • cron job is in #persistent
  • you can also start the backup instantly by pressing win+ctrl+j
  • you will have to adjust the path to the joplin.exe and the timer.

It’s not very elegant but will do the job … until we get somethin like joplin.exe --backup [path] [type] … and it will automate backups which is not a bad thing


here we go:

  • install autohotkey
  • autostart autohotkey with windows:
    create shortcut to autohotkey in %appdata%\Microsoft\Windows\Start Menu\Programs\Startup (win+r / new / shortcut)
  • create Autohotkey.ahk (textfile) in installation dir and add the following code

script code for autohotkey.ahk:

joplinBackup()  ; run backup once when autohotkey is started

#Persistent
time := 1000*60*60 ; time in ms (60min)  
SetTimer, joplinBackup, %time%
return


joplinBackup()
{
joplincmd = c:\_office_\joplin\joplinportable.exe    ; path to the joplin.exe /joplinportable.exe

IfWinExist Joplin
   WinActivate, Joplin
Else 
   run %joplincmd%
   
WinWaitActive, Joplin
Send, !f
Sleep, 1000
Send, e
Sleep, 1000
Send, j{enter}
Sleep, 1000
FormatTime, CurrentDateTime,, yy-MM-dd-HH_mm_ss
SendInput JoplinBackup_%CurrentDateTime%{enter}
}


^#j::               ; win + ctrl + j   instant backup
MsgBox, 4,, Back up Joplin now?
IfMsgBox, Yes
   joplinBackup()
return

1 Like

@Sophia:
5 GB seems rather big … are you sure your images dont take up too much space ? (look in [installation dir]\JoplinProfile\resources\ ) and check your images. Screenshots should be in png or gif format (size should be about 30-100kb) , fotos in jpg (<200kb).
From my experiences with windows, images are sometimes saved or clipped in wmf = raw uncompressed bitmaps. For example a screenshot of the joplin app window (700x700 pix) takes about 30 kb as png and 1400 kb as bmp … so that’s almost 50 times bigger …
So it makes a difference converting all your images into pngs and jpgs (I cut down size 30 times coming from ScribbleNotes) , even more if you want to backup on a regular basis…

Thanks :smiley: This community is so awesome… I’ll check out the script later. Though I’m not sure if I want a script to run that copies across 5G every hour - but I guess that once I get going with it, it’ll be adaptable (1000*60*60*24 would do it, right?).

I’m unsure what the first line means: joplincmd = c:\_office_\joplin\joplinportable.exe - which folder should I edit that to? I’m running the “regularly installed” version of Joplin, not the portable version, so I thought I’d ask before going in too deep :slight_smile:

As for the size of my notes database - I’m afraid so. I bought into the Evernote hype at the time (Remember Everything) and in the past 10 years I have added thousands of notes, many of which PDF files. Especially scanned sheet music can add up, some of those files are dozens of MBs large.

crypted

That said, I do see some odd “.crypted” files in the resources folder, some are over 100MB but I have no means of knowing what they are… does Joplin offer a way to check the size of individual notes including attachments/pictures?

1 Like

yes 1000*60*60*24 = 1 day … but that means the pc has to be switched on the whole day otherwise it will not run … to autorun it with every windows start put backupJoplin() as first line in Autohotkey.ahk (I changed the script to include it…)

joplincmd = c:\_office_\joplin\joplinportable.exe is the path to the joplin program/.exe… the path should be above your resource and profile dir.

about your files sizes:
113 MB or even 62MB for a pdf is quite big … my biggest pdf is 48kb… i guess your pdfs contain scanned images in high res and are not compressed (I wonder what happens if you sync that to a mobile… :smile:) There are tools wich can recompress pdfs but I would reconsider storing gigabytes of filedata (not even notes) in joplin…its a markdown notekeeper and not really a pdf viewer or filebackuptool…

cheers

2 Likes