Difference between revisions of "Anything-sync-daemon"

From ArchWiki
Jump to: navigation, search
m (wording)
m (Sysv (Legacy))
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
[[Category:Scripts]]
 
[[Category:Scripts]]
[[Category:Daemons and system services]]
 
 
{{Article summary start}}
 
{{Article summary start}}
 
{{Article summary text|{{AUR|Anything-sync-daemon}} (asd) is a is a diminutive pseudo-daemon designed to manage target directories in tmpfs and to periodically sync them 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 asd is a completely transparent user experience.}}
 
{{Article summary text|{{AUR|Anything-sync-daemon}} (asd) is a is a diminutive pseudo-daemon designed to manage target directories in tmpfs and to periodically sync them 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 asd is a completely transparent user experience.}}
Line 6: Line 5:
 
{{Article summary wiki|Profile-sync-daemon}}
 
{{Article summary wiki|Profile-sync-daemon}}
 
{{Article summary end}}
 
{{Article summary end}}
 +
 +
== Asd or Psd? ==
 +
{{Note|If syncing browser profiles is desired, it is recommended NOT to use asd for this purpose.  Instead, use psd which has built in sanity checks for unique situations specific to running a browser profile in tmpfs.  Anything-sync-daemon does not have these checks; under certain circumstances, browser profile data can be lost.  You have been warned.}}
  
 
== Benefits of Asd ==
 
== Benefits of Asd ==
Running this pseudo-daemon is beneficial for two reasons:
+
Running this daemon is beneficial for two reasons:
 
#Reduced wear to physical discs
 
#Reduced wear to physical discs
 
#Speed
 
#Speed
  
Since the target directories are relocated into tmpfs, the corresponding onslaught of I/O associated with system usage of them is also redirected from the physical disc to RAM, thus reducing wear to the physical disc and also improving speed and responsiveness. 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.
+
Since the target directories are relocated into tmpfs, the corresponding onslaught of I/O associated with system usage of them is also redirected from the physical disc to RAM, thus reducing wear to the physical disc and also improving speed and responsiveness. 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.
  
 
==Setup and Installation==
 
==Setup and Installation==
Line 18: Line 20:
  
 
=== Edit /etc/asd.conf ===
 
=== Edit /etc/asd.conf ===
Edit the included {{ic|/etc/asd.conf}} defining the target directories in the '''WHATTOSYNC''' array.  These will be syncronized and managed by asd.
+
User managed settings are defined in {{ic|/etc/asd.conf}} which is included in the package. At a minimum, define the target directory/directories to be managed by asd.
 
+
{{note|At least one location needs to be defined.}}
+
  
 
Example:
 
Example:
  WHATTOSYNC=('/srv/http' '/var/lib/monitorix' '/foo/bar')
+
  WHATTOSYNC=('/var/lib/monitorix' '/srv/http' '/foo/bar')
  
{{Warning |Do NOT attempt to add /var/log to the WHATTOSYNC array as systemd will get really pissed if you do so.}}
+
Optionally redefine the location of your distro's tmpfs. Do this by uncommenting and redefining the VOLATILE variable. Note that for Arch Linux, the default value of "/dev/shm" should work just fine. Be sure to read the warning about using software such as bleachbit with asd since bleachbit likes to remove files stored in /tmp. This is why a value of /dev/shm is better.
  
Optionally redefine the location of the tmpfs space to use. Do this in the TMPFS variable.  Note that for Arch Linux, the default value of {{ic|/dev/shm}} should work just fine.  Be sure to read the warning about using software such as bleachbit with asd since bleachbit likes to remove files stored in {{ic|/tmp}}.  This is why a value of {{ic|/dev/shm}} is better.
+
Optionally redefine the permissions of the link in tmpfs. The default is 700 to protect privacy of users.
  
 
=== Using asd ===
 
=== Using asd ===
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, asd will sync back a final time when it is called to stop.
+
Do not call /usr/bin/anything-sync-daemon directly (except to view debug mode). The initial synchronization will occur when the daemon starts. Additionally, cron (if running on your system) will call it to sync or update once per hour. Finally, asd will sync back a final time when it is called to stop.
 
+
==== Using SysVinit (Arch default) ====
+
 
+
Call the asd start, stop, or sync like any standard Arch daemon:
+
# rc.d command asd
+
 
+
It is ''highly'' recommended to start/stop asd at boot/shutdown.  This is accomplished by adding '''asd''' to the DAEMONS array in {{ic|/etc/rc.conf}} like so:
+
DAEMONS=(... @asd ...)
+
  
==== Using systemd ====
+
==== Systemd ====
 +
The provided daemon file should be used to interact with asd ({{ic|/usr/lib/systemd/system/asd.service}}):
 +
# systemctl [option] asd.service
  
Users making use of [[Systemd]] may manage the service using the '''systemctl''' commandStart/stop the service using:
+
Available options:
  # systemctl start asd.service
+
start  Turn on daemon; make symlinks and actively manage targets in tmpfs.
  # systemctl stop asd.service
+
  stop Turn off daemon; remove symlinks and rotate tmpfs data back to disc.
 +
  enable  Autostart daemon when system comes up.
 +
  disable  Remove daemon from the list of autostart daemons.
  
Enable asd to start/stop at boot/shutdown ''(highly recommended)'' using:
+
=== Debug Mode ===
  # systemctl enable asd.service
+
The debug option can be called to show users exactly what asd will do based on the /etc/asd.conf entered. Call it like so:
 +
  $ anything-sync-daemon debug
  
 
=== Sync at More Frequent Intervals (Optional) ===
 
=== Sync at More Frequent Intervals (Optional) ===
Line 58: Line 55:
  
 
Example syncing targets once every ten minutes:
 
Example syncing targets once every ten minutes:
   */10 * * * *    /usr/bin/anything-sync-daemon sync &> /dev/null
+
   */10 * * * *    /usr/bin/anything-sync-daemon resync &> /dev/null
  
 
== Support ==
 
== Support ==
 
Post in the [https://bbs.archlinux.org/viewtopic.php?id=139141 discussion thread] with comments or concerns.
 
Post in the [https://bbs.archlinux.org/viewtopic.php?id=139141 discussion thread] with comments or concerns.

Revision as of 01:23, 26 March 2013

Summary help replacing me
Anything-sync-daemonAUR (asd) is a is a diminutive pseudo-daemon designed to manage target directories in tmpfs and to periodically sync them 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 asd is a completely transparent user experience.
Related
Profile-sync-daemon

Asd or Psd?

Note: If syncing browser profiles is desired, it is recommended NOT to use asd for this purpose. Instead, use psd which has built in sanity checks for unique situations specific to running a browser profile in tmpfs. Anything-sync-daemon does not have these checks; under certain circumstances, browser profile data can be lost. You have been warned.

Benefits of Asd

Running this daemon is beneficial for two reasons:

  1. Reduced wear to physical discs
  2. Speed

Since the target directories are relocated into tmpfs, the corresponding onslaught of I/O associated with system usage of them is also redirected from the physical disc to RAM, thus reducing wear to the physical disc and also improving speed and responsiveness. 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.

Setup and Installation

Anything-sync-daemonAUR is available for download from the AUR. Build it and install like any other package.

Edit /etc/asd.conf

User managed settings are defined in /etc/asd.conf which is included in the package. At a minimum, define the target directory/directories to be managed by asd.

Example:

WHATTOSYNC=('/var/lib/monitorix' '/srv/http' '/foo/bar')

Optionally redefine the location of your distro's tmpfs. Do this by uncommenting and redefining the VOLATILE variable. Note that for Arch Linux, the default value of "/dev/shm" should work just fine. Be sure to read the warning about using software such as bleachbit with asd since bleachbit likes to remove files stored in /tmp. This is why a value of /dev/shm is better.

Optionally redefine the permissions of the link in tmpfs. The default is 700 to protect privacy of users.

Using asd

Do not call /usr/bin/anything-sync-daemon directly (except to view debug mode). The initial synchronization will occur when the daemon starts. Additionally, cron (if running on your system) will call it to sync or update once per hour. Finally, asd will sync back a final time when it is called to stop.

Systemd

The provided daemon file should be used to interact with asd (/usr/lib/systemd/system/asd.service):

# systemctl [option] asd.service

Available options:

start  Turn on daemon; make symlinks and actively manage targets in tmpfs.
stop  Turn off daemon; remove symlinks and rotate tmpfs data back to disc.
enable  Autostart daemon when system comes up.
disable  Remove daemon from the list of autostart daemons.

Debug Mode

The debug option can be called to show users exactly what asd will do based on the /etc/asd.conf entered. Call it like so:

$ anything-sync-daemon debug

Sync at More Frequent Intervals (Optional)

Note: This step is NOT required. asd will update once per hour on its own.

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

# crontab -e

Example syncing targets once every ten minutes:

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

Support

Post in the discussion thread with comments or concerns.