The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniWeb > OmniWeb General
FAQ Members List Calendar Today's Posts

 
Auto-backup workspace(s) Thread Tools Search this Thread Display Modes
Realizing that I should have done this long ago, I went ahead and made a launchd job to backup my main OW workspace daily. It seems particularly a good idea when running the sneaky peeks.

First make a folder called "Backups" in ~/Library/Application Support/OmniWeb 5/Workspaces.

Make a script in that folder; I called it backup.sh. Just paste this into your favorite text editor. After saving the text file, do chmod +x to it in the terminal to make it executable.

"Reading.owworkspace" is the name of the workspace that I'm backing up; more can be added.
The script will produce backups dated like this: Reading-2006.05.02.owworkspace

Code:
#!/bin/sh

cd ~/Library/Application\ Support/OmniWeb\ 5/Workspaces

cp Reading.owworkspace Backups/Reading-`date "+%Y.%m.%d"`.owworkspace
(Incidentally, one could also automate the backing up of URLs into a database by gunzipping the workspaces and extracting the URLs from the xml.)

Then make a new launchd entry, and put it in ~/Library/LaunchAgents. (Make the folder if it's not already.) Again, just another text file. Replace "USER" with your username. The backup time here is set to 5:55 am.

In order to make it backup more than once a day, you need to make a new launchd entry; that is, a new file and a new label (instead of USER.OWworkspacebackup, say, USER.OWworkspacebackup.1 and USER.OWworkspacebackup.2). If you do this, you need to change the above script to add the time to the backups' filenames (`date "+%Y.%m.%d.%H.%m"; see man strftime for other date-time options).

(The path to the script here has to be the full path, so no ~/Library/...; note that spaces and other normally escaped characters do not need to be escaped here.)

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Debug</key>
	<false/>
	<key>GroupName</key>
	<string>USER</string>
	<key>Label</key>
	<string>USER.OWworkspacebackup</string>
	<key>ProgramArguments</key>
	<array>
		<string>/Users/USER/Library/Application Support/OmniWeb 5/Workspaces/Backups/backup.sh</string>
	</array>
	<key>StartCalendarInterval</key>
	<dict>
		<key>Hour</key>
		<integer>5</integer>
		<key>Minute</key>
		<integer>55</integer>
	</dict>
	<key>UserName</key>
	<string>USER</string>
</dict>
</plist>
(Why is it that the [code] tag leaves so much space after the text?)

Lastly, to activate it, do launchctl load on the launchd file in the terminal.

I hope somebody finds this useful; if you have any questions, let me know.
 
Quote:
Originally Posted by afb
[post=1521](Why is it that the [code] tag leaves so much space after the text?)
It preserves formatting. It also uses a fixed-width font.
 
I meant, why does it have to leave five or six lines after the code? I didn't leave any space after.
 
 




Similar Threads
Thread Thread Starter Forum Replies Last Post
Feature Request: Disable auto-dim/auto-lock while plugged in awolfe_ii OmniFocus for iPhone 1 2014-01-13 08:55 AM
Workspace Auto-save feature not turning off? Andymax OmniWeb General 1 2008-07-09 12:16 PM
Auto-complete & Auto-fill Finlay Boo OmniWeb General 1 2007-09-11 12:26 PM
Workspace question Handycam OmniWeb General 4 2007-07-03 09:09 PM
Auto layout is an auto outline disaster bross OmniGraffle General 0 2007-04-16 09:59 AM


All times are GMT -8. The time now is 12:04 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.