# ureadahead - Read required files in advance
#
# Runs the über-readahead daemon which reads data about files required
# during boot and reads them into the page cache in advance of their
# use.

description	"Read required files in advance"

start on starting mountall
stop on stopped rc

# Forks into the background both when reading from disk and when profiling
# (HDD mode won't fork, but that's ok because we'll wait for it in spawned).
expect fork

# When profiling, give it three minutes after sending SIGTERM to write out
# the pack file.
kill timeout 180

# Don't treat a normal exit after reading finishes as a failure
normal exit 0

exec /sbin/ureadahead --daemon

# Normally ureadahead will exit on its own when it finishes, unless it's
# profiling - in which case we want to give the system another 45s to
# finish staring the desktop and other things.
pre-stop exec sleep 45
