Difference between revisions of "Profile-sync-daemon"
m (→Chakra) |
m (→Supported Browsers) |
||
(28 intermediate revisions by 9 users not shown) | |||
Line 25: | Line 25: | ||
*{{AUR|conkeror}} | *{{AUR|conkeror}} | ||
*[[firefox]] (all flavors including stable, beta, and aurora) | *[[firefox]] (all flavors including stable, beta, and aurora) | ||
+ | *[http://www.webupd8.org/2011/05/install-firefox-nightly-from-ubuntu-ppa.html firefox-trunk]: An Ubuntu-only browser | ||
*{{AUR|google-chrome}} | *{{AUR|google-chrome}} | ||
− | *[https://bbs.archlinux.org/viewtopic.php?id=117157 heftig's version of aurora] | + | *{{AUR|google-chrome-beta}} |
+ | *[https://bbs.archlinux.org/viewtopic.php?id=117157 heftig's version of aurora]: An Arch Linux only browser | ||
*[[midori]] | *[[midori]] | ||
*[[opera]] | *[[opera]] | ||
*{{AUR|opera-next}} | *{{AUR|opera-next}} | ||
− | * | + | *Qupzilla |
==Setup and Installation== | ==Setup and Installation== | ||
− | {{AUR| | + | {{AUR|profile-sync-daemon}} is available for download from the [[Arch User Repository|AUR]]. Build it and install like any other package. |
=== Edit /etc/psd.conf === | === Edit /etc/psd.conf === | ||
Line 48: | Line 50: | ||
Optionally uncomment the BROWSERS array and populate it with whichever browser(s) are to be sync'ed to tmpfs. If the BROWSERS array stays commented (default) then all supported browser profiles will be sync'ed if they exist. | Optionally uncomment the BROWSERS array and populate it with whichever browser(s) are to be sync'ed to tmpfs. If the BROWSERS array stays commented (default) then all supported browser profiles will be sync'ed if they exist. | ||
− | Example: Let's say that | + | Example: Let's say that Chromium, Opera and Midori are installed but only Chromium and Opera are to be sync'ed to tmpfs since the user keeps Midori as a backup browser and it is seldom used: |
# List browsers separated by spaces to include in the sync. Useful if you do not | # List browsers separated by spaces to include in the sync. Useful if you do not | ||
Line 57: | Line 59: | ||
# conkeror.mozdev.org | # conkeror.mozdev.org | ||
# firefox | # firefox | ||
+ | # firefox-trunk | ||
# google-chrome | # google-chrome | ||
# heftig-aurora | # heftig-aurora | ||
Line 65: | Line 68: | ||
# | # | ||
# If the following is commented out (default), then all available/supported | # If the following is commented out (default), then all available/supported | ||
− | # browsers will be sync'ed | + | # browsers will be sync'ed, separated by comma |
− | BROWSERS="chromium" | + | BROWSERS="chromium opera" |
== Using PSD == | == Using PSD == | ||
Line 72: | Line 75: | ||
The 'parse' option can be called to show users exactly what psd will do based on the /etc/psd.conf entered. Call it like so: | The 'parse' option can be called to show users exactly what psd will do based on the /etc/psd.conf entered. Call it like so: | ||
$ profile-sync-daemon parse | $ profile-sync-daemon parse | ||
− | Profile-sync-daemon v5. | + | Profile-sync-daemon v5.24 |
Psd will manage the following per /etc/psd.conf settings: | Psd will manage the following per /etc/psd.conf settings: | ||
Line 97: | Line 100: | ||
=== Running PSD to Manage Profiles === | === Running PSD to Manage Profiles === | ||
− | Do not call {{ic|/usr/bin/profile-sync-daemon}} to sync or to unsync directly. Instead use the provided service | + | Do not call {{ic|/usr/bin/profile-sync-daemon}} to sync or to unsync directly. Instead use the provided service files. |
− | + | Both a systemd service file and a timer are provided and should be used to interact with psd. Both should be invoked together! The role of the timer is update the tmpfs copy/copies back to the disk which it does once per hour. Failure to start the resync timer will result in the profile being sync'ed only on start up and shutdown. | |
− | # systemctl [option] psd.service | + | |
+ | # systemctl [option] psd.service psd-resync.service | ||
Available options: | Available options: | ||
− | start Turn on daemon | + | start Turn on daemon and timer. |
− | stop Turn off daemon | + | stop Turn off daemon and timer. |
− | enable Autostart daemon | + | enable Autostart daemon and timer on boot-up. |
− | disable | + | disable Don't autostart daemon and timer on boot-up. |
+ | |||
+ | |||
+ | Start psd and its timer as well as set psd and its timer to start/stop at boot/shutdown ''(highly recommended)'': | ||
+ | # systemctl enable psd.service psd-resync.service | ||
+ | # systemctl start psd.service psd-resync.service | ||
− | + | Obviously, you must first close your browser before starting the service. | |
− | |||
=== Sync at More Frequent Intervals (Optional) === | === Sync at More Frequent Intervals (Optional) === | ||
+ | The package provided timer syncs once per hour. Users may optionally redefine this behavior simply by [[Systemd#Editing_provided_unit_files|extending the systemd unit]]. The example below changes the timer to sync once every ten minutes: | ||
− | {{ | + | {{hc|/etc/systemd/system/psd-resync.timer.d/frequency.conf|2=<nowiki> |
− | + | [Unit] | |
− | + | Description=Timer for Profile-sync-daemon - 10min | |
− | + | [Timer] | |
+ | # Empty value resets the list of timers | ||
+ | OnUnitActiveSec= | ||
+ | OnUnitActiveSec=10min | ||
+ | </nowiki>}} | ||
− | + | See `man systemd.timer` for additional options. | |
− | |||
== Caveats for Firefox and Heftig's Aurora ONLY == | == Caveats for Firefox and Heftig's Aurora ONLY == | ||
Line 140: | Line 152: | ||
IsRelative=0 | IsRelative=0 | ||
Path=/mnt/data/docs/'''happy'''/mozilla/firefox/'''myprofile.abc''' | Path=/mnt/data/docs/'''happy'''/mozilla/firefox/'''myprofile.abc''' | ||
+ | |||
+ | == FAQ == | ||
+ | {{Note|The first three questions apply to versions of psd equal to or greater than v5.40 only.}} | ||
+ | === Q1. My system crashed and didn't sync back. What do I do? === | ||
+ | Odds are the "last good" backup of your browser profiles is just fine still sitting happily on your filesystem. Upon restarting psd (on a reboot for example), a check is preformed to see if the symlink to the tmpfs copy of your profile is invalid. If it is invalid, psd will snapshot the "last good" backup before it rotates it back into place. This is more for a sanity check that psd did no harm and that any data loss was a function of something else. | ||
+ | |||
+ | === Q2. Where can I find this snapshot? === | ||
+ | It depends on the browser. You will find the snapshot in the same directory as the browser profile and it will contain a date-time-stamp that corresponds to the time at which the recovery took place. For example, chromium will be {{ic|~/.config/chromium-backup-crashrecovery-20130912_153310}} -- of course, the date_time suffix will be different for you. | ||
+ | |||
+ | === Q3. How can I restore the snapshot? === | ||
+ | *Stop psd. | ||
+ | *Confirm that there is no symlink to the tmpfs browser profile directory. If there is, psd did not stop correctly for other reasons. | ||
+ | *Move the "bad" copy of the profile to a backup (don't blindly delete anything). | ||
+ | *Copy the snapshot directory to the name that browser expects. | ||
+ | |||
+ | Example using chromium: | ||
+ | mv ~/.config/chromium ~/.config/chromium-bad | ||
+ | cp -a ~/.config/chromium-backup-crashrecovery-20130912_153310 ~/.config/chromium | ||
+ | |||
+ | At this point you can launch chromium which will use the backup snapshot you just copied into place. If all is well, close the browser and restart psd and psd-resync (if using systemd). You may safely delete {{ic|~/.config/chromium-backup-crashrecovery-20130912_153310}} at this point. | ||
== Support == | == Support == | ||
Line 145: | Line 177: | ||
== PSD On Other Distros == | == PSD On Other Distros == | ||
− | Psd is a | + | Psd is a bash script and should therefore run on any Linux distro. Below is a list of distros known to package psd, and a link to download their respective packages. |
− | == | + | {{Note|Different distros use different init systems. The packages linked below are configured to use the default init system for the given distro.}} |
− | http://chakra-linux.org/ccr/packages.php?ID= | + | |
+ | {| class="wikitable" align="center" | ||
+ | |- | ||
+ | ! Distro !! Default Init System !! Link to Package | ||
+ | |- | ||
+ | | Arch || Systemd || [https://aur.archlinux.org/packages/profile-sync-daemon AUR]. | ||
+ | |- | ||
+ | | Chakra || Systemd || [http://chakra-linux.org/ccr/packages.php?ID=5008 CCR]. | ||
+ | |- | ||
+ | | Debian || Upstart || Graysky's PPA. See instruction below. | ||
+ | |- | ||
+ | | Exherbo || Systemd || [http://git.exherbo.org/summer/packages/net-www/profile-sync-daemon In official repos]. | ||
+ | |- | ||
+ | | Fedora || Systemd || [http://koji.fedoraproject.org/koji/packageinfo?packageID=16307 In official repos]. | ||
+ | |- | ||
+ | | Gentoo || OpenRC || [http://packages.gentoo.org/package/www-misc/profile-sync-daemon In official repos]. | ||
+ | |- | ||
+ | | Mint || Upstart || Graysky's PPA. See instruction below. | ||
+ | |- | ||
+ | | OpenSUSE || Upstart || Packaged by [http://download.opensuse.org/repositories/home:/Overman79:/Laptop Overman79]. | ||
+ | |- | ||
+ | | Ubuntu || Upstart || Graysky's PPA, See instruction below. | ||
+ | |- | ||
+ | | Void || Systemd || In official [https://github.com/xtraeme/xbps-packages/tree/master/srcpkgs/profile-sync-daemon repos]. | ||
+ | |} | ||
=== Debian === | === Debian === | ||
Line 159: | Line 215: | ||
# apt-get install profile-sync-daemon | # apt-get install profile-sync-daemon | ||
− | === | + | === Mint and Ubuntu === |
− | |||
− | |||
To add the PPA (personal package archive) to your Ubuntu (packages available for Lucid and newer) system, and to install psd: | To add the PPA (personal package archive) to your Ubuntu (packages available for Lucid and newer) system, and to install psd: | ||
Line 167: | Line 221: | ||
$ sudo apt-get update | $ sudo apt-get update | ||
$ sudo apt-get install profile-sync-daemon | $ sudo apt-get install profile-sync-daemon | ||
+ | |||
+ | == External Links Mentioning PSD == | ||
+ | *http://www.webupd8.org/2013/02/keep-your-browser-profiles-in-tmpfs-ram.html | ||
+ | *http://bernaerts.dyndns.org/linux/250-ubuntu-tweaks-ssd |
Revision as of 20:43, 22 October 2013
Template:Article summary start Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary end
Contents
Benefits of Psd
Running this daemon is beneficial for two reasons:
- Reduced wear to physical discs
- Speed
Since the profile(s), browser cache*, etc. are relocated into tmpfs (RAM disk), the corresponding onslaught of I/O associated with using the browser is also redirected from the physical disc to RAM, thus reducing wear to the physical disc and also greatly improving browser speed and responsiveness. For example, the access time of RAM is on the order of nanoseconds while the access time of physical discs is on the order of milliseconds. This is a difference of six orders of magnitude or 1,000,000 times faster.
Supported Browsers
Currently, the following browsers are auto-detected and managed:
- chromium
- conkerorAUR
- firefox (all flavors including stable, beta, and aurora)
- firefox-trunk: An Ubuntu-only browser
- google-chromeAUR
- google-chrome-betaAUR
- heftig's version of aurora: An Arch Linux only browser
- midori
- opera
- opera-nextAUR
- Qupzilla
Setup and Installation
profile-sync-daemonAUR is available for download from the AUR. Build it and install like any other package.
Edit /etc/psd.conf
Edit the included /etc/psd.conf
defining which user(s) will have their profiles managed by psd.
Example:
# List users separated by spaces whose browser(s) profile(s) will get symlinked # and sync'ed to tmpfs. # Do NOT list a user twice! USERS="facade happy"
Optionally uncomment the BROWSERS array and populate it with whichever browser(s) are to be sync'ed to tmpfs. If the BROWSERS array stays commented (default) then all supported browser profiles will be sync'ed if they exist.
Example: Let's say that Chromium, Opera and Midori are installed but only Chromium and Opera are to be sync'ed to tmpfs since the user keeps Midori as a backup browser and it is seldom used:
# List browsers separated by spaces to include in the sync. Useful if you do not # wish to have all possible browser profiles sync'ed. # # Possible values: # chromium # conkeror.mozdev.org # firefox # firefox-trunk # google-chrome # heftig-aurora # midori # opera # opera-next # qupzilla # # If the following is commented out (default), then all available/supported # browsers will be sync'ed, separated by comma BROWSERS="chromium opera"
Using PSD
Preview Mode (Parse)
The 'parse' option can be called to show users exactly what psd will do based on the /etc/psd.conf entered. Call it like so:
$ profile-sync-daemon parse Profile-sync-daemon v5.24 Psd will manage the following per /etc/psd.conf settings: browser/psname: chromium/chromium owner/group: facade/users sync target: /home/facade/.config/chromium tmpfs dir: /tmp/facade-chromium profile size: 81M browser/psname: firefox/firefox owner/group: facade/users sync target: /mnt/data/docs/facade/mozilla/firefox/1Zp9V43q.banking tmpfs dir: /tmp/facade-firefox-1Zp9V43q.banking profile size: 5.9M browser/psname: firefox/firefox owner/group: facade/users sync target: /mnt/data/docs/facade/mozilla/firefox/obg67zqQ.proxy tmpfs dir: /tmp/facade-firefox-obg67zqQ.proxy profile size: 17M
As shown in the output and as stated above, if no specific browser or subset of browsers are defined in the BROWSERS array, psd will sync ALL supported profiles that it finds for the given user(s).
Running PSD to Manage Profiles
Do not call /usr/bin/profile-sync-daemon
to sync or to unsync directly. Instead use the provided service files.
Both a systemd service file and a timer are provided and should be used to interact with psd. Both should be invoked together! The role of the timer is update the tmpfs copy/copies back to the disk which it does once per hour. Failure to start the resync timer will result in the profile being sync'ed only on start up and shutdown.
# systemctl [option] psd.service psd-resync.service
Available options:
start Turn on daemon and timer. stop Turn off daemon and timer. enable Autostart daemon and timer on boot-up. disable Don't autostart daemon and timer on boot-up.
Start psd and its timer as well as set psd and its timer to start/stop at boot/shutdown (highly recommended):
# systemctl enable psd.service psd-resync.service # systemctl start psd.service psd-resync.service
Obviously, you must first close your browser before starting the service.
Sync at More Frequent Intervals (Optional)
The package provided timer syncs once per hour. Users may optionally redefine this behavior simply by extending the systemd unit. The example below changes the timer to sync once every ten minutes:
/etc/systemd/system/psd-resync.timer.d/frequency.conf
[Unit] Description=Timer for Profile-sync-daemon - 10min [Timer] # Empty value resets the list of timers OnUnitActiveSec= OnUnitActiveSec=10min
See `man systemd.timer` for additional options.
Caveats for Firefox and Heftig's Aurora ONLY
The way psd keeps track of browser profiles and sync targets requires users to have a unique name as the last directory for all profiles in their respective $HOME/.mozilla/<browser>/profiles.ini files. Psd will check when it is called to run for this and refuse if this rule is not satisfied. The following is an example of a BAD profile that will fail the the test. Note that although each full path is unique, they both end in the same name! Again, the user must modify the profiles.ini and the corresponding directory on the filesystem to correct this in order to use Psd.
$ cat ~/.mozilla/firefox/profiles.ini [General] StartWithLastProfile=1 [Profile0 for user facade] Name=normal IsRelative=0 Path=/mnt/data/docs/facade/mozilla/firefox/myprofile.abc Default=1 [Profile1 for user happy] Name=proxy IsRelative=0 Path=/mnt/data/docs/happy/mozilla/firefox/myprofile.abc
FAQ
Q1. My system crashed and didn't sync back. What do I do?
Odds are the "last good" backup of your browser profiles is just fine still sitting happily on your filesystem. Upon restarting psd (on a reboot for example), a check is preformed to see if the symlink to the tmpfs copy of your profile is invalid. If it is invalid, psd will snapshot the "last good" backup before it rotates it back into place. This is more for a sanity check that psd did no harm and that any data loss was a function of something else.
Q2. Where can I find this snapshot?
It depends on the browser. You will find the snapshot in the same directory as the browser profile and it will contain a date-time-stamp that corresponds to the time at which the recovery took place. For example, chromium will be ~/.config/chromium-backup-crashrecovery-20130912_153310
-- of course, the date_time suffix will be different for you.
Q3. How can I restore the snapshot?
- Stop psd.
- Confirm that there is no symlink to the tmpfs browser profile directory. If there is, psd did not stop correctly for other reasons.
- Move the "bad" copy of the profile to a backup (don't blindly delete anything).
- Copy the snapshot directory to the name that browser expects.
Example using chromium:
mv ~/.config/chromium ~/.config/chromium-bad cp -a ~/.config/chromium-backup-crashrecovery-20130912_153310 ~/.config/chromium
At this point you can launch chromium which will use the backup snapshot you just copied into place. If all is well, close the browser and restart psd and psd-resync (if using systemd). You may safely delete ~/.config/chromium-backup-crashrecovery-20130912_153310
at this point.
Support
Post in the discussion thread with comments or concerns.
PSD On Other Distros
Psd is a bash script and should therefore run on any Linux distro. Below is a list of distros known to package psd, and a link to download their respective packages.
Distro | Default Init System | Link to Package |
---|---|---|
Arch | Systemd | AUR. |
Chakra | Systemd | CCR. |
Debian | Upstart | Graysky's PPA. See instruction below. |
Exherbo | Systemd | In official repos. |
Fedora | Systemd | In official repos. |
Gentoo | OpenRC | In official repos. |
Mint | Upstart | Graysky's PPA. See instruction below. |
OpenSUSE | Upstart | Packaged by Overman79. |
Ubuntu | Upstart | Graysky's PPA, See instruction below. |
Void | Systemd | In official repos. |
Debian
To add the PPA (personal package archive) to your Debian (tested on squeeze) system, and to install psd:
# echo "deb http://ppa.launchpad.net/graysky/utils/ubuntu quantal main" > /etc/apt/sources.list.d/graysky.list # echo "deb-src http://ppa.launchpad.net/graysky/utils/ubuntu quantal main" >> /etc/apt/sources.list.d/graysky.list # apt-key adv --keyserver keyserver.ubuntu.com --recv-keys FF7F9516 # apt-get update # apt-get install profile-sync-daemon
Mint and Ubuntu
To add the PPA (personal package archive) to your Ubuntu (packages available for Lucid and newer) system, and to install psd:
$ sudo add-apt-repository ppa:graysky/utils $ sudo apt-get update $ sudo apt-get install profile-sync-daemon