If your encrypted volume is /dev/sda2, you would enable the service with this command:

# systemctl enable truecrypt@dev-sda2.service

Note: If you use mpd or any other program that needs to access the encrypted filesystem, put it into the line starting with Before=, separated with a space from the first entry.

Note: There is an issue possibly arising from this approach: side-by-side compatibility of mounting more than one device in this way. If you have problems mounting more than one device during startup (e.g. with the two password prompts interfering) and/or want to avoid entering multiple passwords, you could consider securing the second and further devices by a keyfile located on the first encrypted device.

Note: Although it works, there might be better solutions to use truecrypt with systemd: This way of doing it (specifically the use of tty-force) is not recommended according to this thread, which suggests an alternative approach similar to that taken for LUKS. Another possibility might be tcplay.

Note: Gleaned from bpont on the forums. If you use mpd and have your music dir in ~/, uncomment Before=mpd.service, which takes care that mpd is started after this script. If you also use truecrypt-unmount.service (see next service) uncomment the Requires=truecrypt-unmount.service and Also=truecrypt-unmount.service so it gets installed and activated by systemd automatically when using this script.

Note: I don't know if this works yet. It may be necessary to replace TimeoutSec=5 with ExecStart=sleep 5. If you use mpd, make sure to uncomment Before=mpd.service to make sure this service is executed after mpd is closed down (different order during the shutdown of processes than during start up!). Script gleaned from tladuke on the forums.

MPD Socket Activation

If the following mpd.socket file is enabled while mpd.service (provided by mpd) is disabled, systemd will not start mpd immediately, but it will listen on the appropriate sockets. When an mpd client attempts to connect on one of those sockets, systemd will start mpd.service and transparently hand over control of those ports to the mpd process.

If you prefer to listen on different UNIX sockets or network ports (even multiple sockets of each type), or if you prefer not to listen on network ports at all, you should add/edit/remove the appropriate "ListenStream=" lines in the [Socket] section of mpd.socketAND modify the appropriate lines /etc/mpd.conf (see man 5 mpd.conf for more details).

If you use different (even multiple) network or local sockets, or prefer not to use network sockets at all, simply add, change, or remove lines beginning with "ListenStream=" in the [Socket] section.

/home/username/.config/btsync/btsync.config - the user's config file. Consult the official instructions for creating one.

/home/username/.config/btsync/btsync.pid - BitTorrent Sync creates $SYNC_HOME/sync.pid automatically, where $SYNC_HOME is specified by "storage_path" in the config file. Either point PIDFile to it, or symlink this file to it.