{{Article summary text|{{AUR|Profile-sync-daemon}} (psd) is a diminutive pseudo-daemon designed to manage your browser's profile in tmpfs and to periodically sync it back to your physical disc (HDD/SSD). This is accomplished via a symlinking step and an innovative use of rsync to maintain back-up and synchronization between the two. One of the major design goals of psd is a completely transparent user experience.}}

{{Article summary text|{{AUR|Profile-sync-daemon}} (psd) is a diminutive pseudo-daemon designed to manage your browser's profile in tmpfs and to periodically sync it back to your physical disc (HDD/SSD). This is accomplished via a symlinking step and an innovative use of rsync to maintain back-up and synchronization between the two. One of the major design goals of psd is a completely transparent user experience.}}

Line 21:

Line 20:

{{Note|Chromium actually keeps its cache directory '''separately''' from its browser profile directory. It is not within the scope of profile-sync-daemon to modify this behavior; users are encouraged to refer to the [[Chromium_Tips_and_Tweaks#Cache_in_tmpfs]] section of the main [[Chromium_Tips_and_Tweaks]] article for several work-arounds.}}

{{Note|Chromium actually keeps its cache directory '''separately''' from its browser profile directory. It is not within the scope of profile-sync-daemon to modify this behavior; users are encouraged to refer to the [[Chromium_Tips_and_Tweaks#Cache_in_tmpfs]] section of the main [[Chromium_Tips_and_Tweaks]] article for several work-arounds.}}

*[https://bbs.archlinux.org/viewtopic.php?id=117157 heftig's version of aurora]

+

*[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]]

+

*Qupzilla

==Setup and Installation==

==Setup and Installation==

−

{{AUR|Profile-sync-daemon}} is available for download from the [[Arch User Repository|AUR]]. Build it and install like any other package.

+

{{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 49:

Line 49:

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 both chromium and mirdori are installed but only chromium is to be sync'ed to tmpfs since the user keeps Midori as a backup browser and it is seldom used:

+

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 58:

Line 58:

# conkeror.mozdev.org

# conkeror.mozdev.org

# firefox

# firefox

+

# firefox-trunk

# google-chrome

# google-chrome

# heftig-aurora

# heftig-aurora

Line 66:

Line 67:

#

#

# 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"

−

Optionally redefine the location of the tmpfs mount to use for syncs. Do this in the VOLATILE variable. Note that for Arch Linux, the default value of "/tmp" should work just fine.

+

== 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

−

=== Using psd ===

+

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).

−

The initial synchronization will occur when the pseudo-daemon starts. Additionally, cron (if running) will call it to ''sync'' or update once per hour. Finally, psd will sync back a final time when it is called to stop.

−

The provided daemon file should be used to interact with psd ({{ic|/usr/lib/systemd/system/psd.service}}):

+

=== Running PSD to Manage Profiles ===

−

# systemctl [option] psd.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 psd-resync.service

Available options:

Available options:

−

start Turn on daemon; make symlinks and actively manage targets in tmpfs.

+

start Turn on daemon and timer.

−

stop Turn off daemon; remove symlinks and rotate tmpfs data back to disc.

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

+

# 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 be creating their own timer with whatever interval is desired. The example below syncs once every ten minutes:

−

{{Note|This step is NOT required. '''Psd''' will update once per hour on its own thanks to /etc/cron.hourly/psd-update -- psd does NOT remain running in memory!}}

+

{{hc|/etc/systemd/system/my-psd-resync.timer|2=<nowiki>

+

[Unit]

+

Description=My own profile resync

+

After=psd.service

+

Conflicts=psd-resync.timer

−

Users wishing to have syncs occur more frequently can simply add a line to the root crontab to call the ''sync'' function of psd like so:

+

[Timer]

+

Unit=psd-resync.service

+

OnUnitActiveSec=10min

+

</nowiki>}}

+

{{Note|The 'Conflicts...' line disables the package-provided timer and allows 'my-psd-resync.timer' to take over and work with psd-resync.service.}}

−

# crontab -e

+

See `man systemd.timer` for additional options.

−

Example syncing all profiles being managed once every ten minutes:

+

== Caveats for Firefox and Heftig's Aurora ONLY ==

−

*/10 * * * * /usr/bin/profile-sync-daemon sync &> /dev/null

+

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.

−

=== Debug Mode ===

+

$ cat ~/.mozilla/firefox/profiles.ini

−

The debug 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 debug

+

[General]

−

+

StartWithLastProfile=1

−

As stated above, if no specific browser or set of browsers are defined in the BROWSERS array, psd will sync ALL profiles that it finds for the given user.

+

+

[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'''

== Support ==

== Support ==

Post in the [https://bbs.archlinux.org/viewtopic.php?pid=1026974 discussion thread] with comments or concerns.

Post in the [https://bbs.archlinux.org/viewtopic.php?pid=1026974 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.

+

+

{{Note|Different distros use different init systems. The packages linked below are configured to use the default init system for the given distro.}}

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.

Note: Chromium actually keeps its cache directory separately from its browser profile directory. It is not within the scope of profile-sync-daemon to modify this behavior; users are encouraged to refer to the Chromium_Tips_and_Tweaks#Cache_in_tmpfs section of the main Chromium_Tips_and_Tweaks article for several work-arounds.

Setup and Installation

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"

Note: At least one user must be defined.

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:

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.

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 be creating their own timer with whatever interval is desired. The example below syncs once every ten minutes:

Note: The 'Conflicts...' line disables the package-provided timer and allows 'my-psd-resync.timer' to take over and work with psd-resync.service.

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.