Sophie

Sophie

distrib > Fedora > 13 > i386 > by-pkgid > 2b6d57de11205d1e4ec8b18312057c35 > files > 205

initng-ifiles-0.1.5-4.fc12.i686.rpm

#!/sbin/itype
# This is a i file, used by initng parsed by install_service

# NAME:
# DESCRIPTION:
# WWW:


service service/readahead/stopper {
	last;
	script start = {
	    [ -e /var/run/readahead-watch.pid ] && kill `cat /var/run/readahead-watch.pid`
	    [ -e /var/run/readahead-watch-boot.pid ] && kill `cat /var/run/readahead.pid`
	    exit 0
	};
}


# This watcher, is launched after /usr /var is mounted.
daemon service/readahead/watcher-desktop {
	need = system/mountfs/essential;
	also_start = service/readahead/stopper;
	forks;
	script daemon = {
	    # Move away the old pid created by service/readahead/watcher
	    mv /var/run/readahead-watch.pid /var/run/readahead-watch-boot.pid

	    # Add /usr to dirs, if that is a mountpoint
	    if mountpoint -q /usr; then
		dirs="$dirs /usr"
	    fi

	    # Add /var to dirs, if that is a mountpoint
	    if mountpoint -q /var; then
		dirs="$dirs /var"
	    fi

	    exec /usr/sbin/readahead-watch -o /etc/readahead/desktop $dirs

	    #Never get here
	    exit 1
	};
}

daemon service/readahead/watcher {
	need = system/mountfs/essential;
	also_start = service/readahead/stopper;
	forks;
	script daemon = {

	    # If /usr or /var is mounted on another filesystem, make sure they will also be checked
	    mountpoint -q /usr && /sbin/ngc --quiet --instant -u service/readahead/watcher-desktop
	    mountpoint -q /var && /sbin/ngc --quiet --instant -u service/readahead/watcher-desktop

	    # Okay, launch watcher.
	    exec /usr/sbin/readahead-watch -o /etc/readahead/boot;

	    exit 1
	};
	pid_file = /var/run/readahead-watch.pid;
}

# This is started, when /usr is surely mounted
service service/readahead/desktop {
	need = system/mountfs/essential;
	script start = {
	    if [ -e /etc/readahead/desktop ]
	    then
		[ -x /sbin/readahead-watch ] && exec /sbin/readahead-watch -o /etc/readahead/desktop
	    fi
	    exit 0
	};
}

service service/readahead {
	need = system/mountfs/essential;
	script start = {
		# Check if /usr/sbin/readahead-list exits.
		if [ -x /usr/sbin/readahead-list ]
		then

			# The recent implention uses /sbin/readahead-watch to get the list
			if [ -e /etc/readahead/boot ]
			then
				echo " Reading ahead, from list /etc/readahead/boot "
				exec /usr/sbin/readahead-list /etc/readahead/boot
				exit 1
			else
			# if the watcher exist, generate /etc/readahead/boot
			echo "Starting service/readahead/watcher, to collect boot record data "
			/sbin/ngc --instant --quiet -u service/readahead/watcher
			# Sleep 4 seconds, so readahead-watcher really stars, and got all.
			echo "Sleep 4"
			sleep 1
			echo "Sleep 3"
			sleep 1
			echo "Sleep 2"
			sleep 1
			echo "Sleep 1"
			sleep 1
			fi

			# This is the old location for readahead file
			if [ -e /etc/readahead/readahead ]
			then
			exec /usr/sbin/readahead-list /etc/readahead/readahead
			fi

		fi
		exit 0
	};


	# Some old implention, uses filelist-order to oganize the readahead order.
	#script stop = {
	#	/usr/bin/filelist-order /etc/readahead/readahead > /etc/readahead/readahead.new
	#	/bin/mv -f /etc/readahead/readahead.new /etc/readahead/readahead
	#};
}