Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Auto-backup of the Stickies database Apps
This AppleScript maintains three backups of the Stickies file to compensate for the occasional lost Stickies problem in MacOS X.

Save this script as an application (from ScriptEditor) and use it to start-up Stickies in your Login items. It will rotate the backups before starting. I maintain multiple backups in case you log in more than once before noticing that your stickies file has been swiped clean.

Read the rest of the article for the script.

File Information:

Original file
~/Library/.StickiesDatabase

Backup Files
~/Library/Application Support/Stickies/StickiesDatabase.1 (most recent)
~/Library/Application Support/Stickies/StickiesDatabase.2
~/Library/Application Support/Stickies/StickiesDatabase.3 (oldest)

The AppleScript
--Begin AppleScript--

try
do shell script "mkdir ~/Library/Application\\ Support/Stickies"
end try

try
do shell script "cp ~/Library/Application\\ Support/Stickies/StickiesBackup.2 ~/Library/Application\\ Support/Stickies/StickiesBackup.3"
end try

try
do shell script "cp ~/Library/Application\\ Support/Stickies/StickiesBackup.1 ~/Library/Application\\ Support/Stickies/StickiesBackup.2"
end try

try
do shell script "cp ~/Library/.StickiesDatabase ~/Library/Application\\ Support/Stickies/StickiesBackup.1"
end try

tell application "Stickies"
activate
end tell

--End Apple Script--
NOTE: The "cp" script lines are wrapping; they should be entered as one line in the script. To restore your stickies, just copy one of the backup files over the original .StickiesDatabase.
    •    
  • Currently 1.00 / 5
  You rated: 1 / 5 (1 vote cast)
 
[16,035 views]  

Auto-backup of the Stickies database | 15 comments | Create New Account
Click here to return to the 'Auto-backup of the Stickies database' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Couldn't get it to work
Authored by: salty on Jan 22, '02 10:37:37AM

The script choked expecting a close speechmark after the backslash on the following line...


  do shell script "mkdir ~/Library/Application Support/Stickies"

Is it something I'm doing wrong?

Cheers,
Salty



[ Reply to This | # ]
Couldn't get it to work
Authored by: salty on Jan 22, '02 10:43:17AM

DOh! the backslash disappeared in my post, it's the one before the space in 'application support' I put in an [ampersand hash 92 semicolon] too :S
\ ... whatever....



[ Reply to This | # ]
My fault and fixed now!
Authored by: robg on Jan 22, '02 10:45:26AM

While editing the story, I deleted an extra backslash by mistake and didn't catch it -- the backslashes need to be doubled, as they are now in the story.

Thanks for the catch, and sorry for the problem.

-rob.



[ Reply to This | # ]
Re: My fault and fixed now!
Authored by: salty on Jan 22, '02 10:56:36AM

LOL... I thought I was going mad for a minute, when I went back to verify my post the double backslashes had appeared ;)

Thanks, the script works nicely now.

Salty



[ Reply to This | # ]
Grrr! Hidden Files
Authored by: tomdarch on Jan 22, '02 12:50:53PM

I installed 10.1 last week (I had to repartition the drive to do the install). I've been replacing my important files and I spent an hour last night looking for the damn Stickies file! Why is this a 'hidden' file? Goes to show that I should have been looking with the command line with ls -alF rather than Sherlock!

Actually, I just looked more closely at Sherlock's search options and when I turned on "is invisible" it showed up! Now the problem is that you can either search for "visible" or "invisible" but not _all_ files!

[ Reply to This | # ]

CRON
Authored by: iacas on Jan 22, '02 07:32:46PM

This is the kind of thing a nice little crontab along with a shell script are for. :-P



[ Reply to This | # ]
re .StickiesDatabase
Authored by: kc on Jan 22, '02 09:47:06PM

Non-unix user here.

Couldn't figure how to copy the file out of Sherlock. Refused to move.

But stumbled on partial solution:

When in Stickies, go to "File/Print All Notes..."

Select "Preview"

Then "Save As PDF" out of Preview.

You get a PDF with <strong>all</strong> your Stickies info, even images!

kc



[ Reply to This | # ]
re .StickiesDatabase
Authored by: TvE on Mar 29, '05 03:33:35AM

Then how do you plan to restore from backup???



[ Reply to This | # ]
Response to Comments
Authored by: james_sorenson on Jan 23, '02 01:57:32AM

Hmmmm...I wasn't expecting this much traffic on my script.
To iacas:
I considered this, but since the Stickies tend to "die" only when they are started (and I leave my Stickies running the whole time I'm logged in), I decided it was sufficient to just make a copy before running Stickies. My fear is what if the file corruption occurs when Stickies closes? If you close Stickies, and cron starts to happily overwrite the backups, you might end up with nothing left to go back on the next time you start Stickies. I suppose one could modify the cron statement to only make backups if Stickies is running.

to kc:
The graphics are text-encoded into the file, so this backup saves everything. True, the only way to copy the backup file back is through the terminal. Just utilize one of the "cp" commands from the script, only reverse the files. I suppose, if a few requested it, I could throw together a script that would allow you to select the file to restore, and it would do it for you.

Of course, none of this would be so troublesome if Apple didn't decide to hide our own document! Preferences are one thing (and those aren't even hidden), but to hide an actual data document is both baffling and infuriating. I've been trying to find a hack that will allow me to name my own Stickies data file. No luck, so far.

Anyway, thanks for the feedback!



[ Reply to This | # ]
Stickies Icky Database
Authored by: kc on Jan 24, '02 02:03:34PM

Of course, an ultra-non geeky workaround is to boot into OS 9.

All ".whatever" files are visible in 9.

Copy to a safe place, remove the ".", and the backup file will now be visible in X.

But I WILL learn some UNIX basics, one of these days...

thx

kc



[ Reply to This | # ]
Response to Comments
Authored by: hayne on Feb 01, '02 12:33:38PM
James Sorenson said:
Of course, none of this would be so troublesome if Apple didn't decide to hide our own document! Preferences are one thing (and those aren't even hidden), but to hide an actual data document is both baffling and infuriating. I've been trying to find a hack that will allow me to name my own Stickies data file. No luck, so far.
You can alleviate this by making a symbolic link (alias) to the hidden file. In The Terminal, do the following:
cd ~/Library
ln -s .StickiesDatabase StickiesDatabase
This will give you a readily visible name "StickiesDatabase".

[ Reply to This | # ]
Thank you!
Authored by: ebow on Mar 08, '02 10:25:17AM

I only wish I'd payed attention to this script/hint when it came out. I had to restart due to VM running out of space (somehow) and when I did, *poof*, all my Stickies were gone. And I use them for reminding myself about almost everything. Sigh. Well *now* I'm protected. Damn slightly buggy software! And damn Apple for being weird and using a dot-file for *this* app, and almost nothing else (it's just a strange move).



[ Reply to This | # ]
Auto-backup of the Stickies database
Authored by: joelseph on Mar 28, '05 09:03:45PM

I noticed this hint when it first came out... tried to follow it.... but I've encountered rather odd circumstances...

... my .StickiesDatabase file is missing. I don't mean hidden, I'm showing hidden files with TinkerTool. I've looked all over for it, can't find it in any of the obvious places.... yet I know it's around, My stickies still work. Also, after I could find the file, I tried backing up my stickies with SpyMac. It acted like it worked ok... but when I checked the server space where it stores the backups, there is no stickies backup there.

Any ideas?



[ Reply to This | # ]
Auto-backup of the Stickies database
Authored by: chirsg on Mar 30, '05 02:41:41AM

Try looking for "~/Library/StickiesDatabase". (Notice there's no dot anymore.) That's where my Stickies seem to be hanging out these days.



[ Reply to This | # ]
Auto-backup of the Stickies database
Authored by: GcBrand on Apr 22, '10 10:15:13AM

Hello
First time user and right off the bat I guess I should say I might me on the lower end type of tech user, not to savvy in other words.
I saw your post and i tried what I though it would be what you were saying to do.
I pasted the script into applescript editor and I saved it as an application, and told it to run application.
this is what I pasted, and I even try to use only one of the lines like the .1 or .2 and the .3
--Begin AppleScript--

try
do shell script "mkdir ~/Library/Application\\ Support/Stickies"
end try

try
do shell script "cp ~/Library/Application\\ Support/Stickies/StickiesBackup.2 ~/Library/Application\\ Support/Stickies/StickiesBackup.3"
end try

try
do shell script "cp ~/Library/Application\\ Support/Stickies/StickiesBackup.1 ~/Library/Application\\ Support/Stickies/StickiesBackup.2"
end try

try
do shell script "cp ~/Library/.StickiesDatabase ~/Library/Application\\ Support/Stickies/StickiesBackup.1"
end try

tell application "Stickies"
activate
end tell

--End Apple Script--
but nothing really happen it open stickies as I had them then I deleted the stickies database file in the user library but that just reset the stickies to default
I replaced the database file and Im pretty much where I started.
a day ago I deleted a sticky note with lots of good information. I panic and didn't even think about using undo.
dahh
but that was yesterday i shut down my machine and I am so desperate i really would like to get that file back
is the anything I can do now and can you please help.

thank you
blue



[ Reply to This | # ]