Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Parallel rc.d scripts executer for FreeBSD

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 testcase
Octocat-spinner-32 Makefile
Octocat-spinner-32 README
Octocat-spinner-32 ealloc.c
Octocat-spinner-32 ealloc.h
Octocat-spinner-32 etc.patch.txt
Octocat-spinner-32 hash.c
Octocat-spinner-32 hash.h
Octocat-spinner-32 rcexecr.8
Octocat-spinner-32 rcexecr.c
Octocat-spinner-32 sprite.h
README
rcexecr is modified from rcorder(8) from freebsd(/netbsd)

It aims to do things that rcorder and part of /etc/rc do in parallel.

Test with modification on /etc:
	#install
	cd /usr/src/sbin/
	git clone git://github.com/buganini/rcexecr.git
	cd rcexecr
	sudo make all install

	#patch /etc
	cd /etc/
	patch -p1 < /usr/src/sbin/rcexecr/etc.patch.txt

	#enable parallel execution
	echo rcexecr_parallel="YES" >> /etc/rc.conf

	#reboot
	shutdown -r now

Test without affecting system:
	cd /usr/src/sbin/
	git clone git://github.com/buganini/rcexecr.git
	cd rcexecr
	sudo make

	env ARG0=\? ARG1=start./rcexecr /etc/rc.d/*
	env ARG0=\? ARG1=stop ./rcexecr -r /etc/rc.d/*

	#add -x to actually execute
	env ARG0=\? ./rcexecr -x testcase/rc.d/*

	#test self modification
	chmod -R 755 testcase/
	env ARG0=\? ./rcexecr -x testcase/rc.d/*

Progress:
	beg/end calculation: done
	fork/exec/waitpid/-x(execute, or dry print): done
	-r(reverse, for /etc/rc.shutdown): done
	self modification: done
	patch for /etc: done
	update document: partial

Concept:
	beg/end: the proper timing to launch script / wait it finished.
	When a node's requirement is satisfied, it would be launched by fork()+exec().
	When a node is required to be done, it would be waited for by waitpid().

	the whole schedule is reversed with -r.

	Circular dependency detecting:
		see https://github.com/buganini/rcexecr/commit/8460c6006dd041fe4920047ee80c3bd19896f493

	Self modification:
		consider the dependencies as a graph, the files as nodes,
		when subprocess exec(rcexecr), the node take whole graph as input,
		and regenerate it with adding new node.
		approach:
			if (getenv("RCEXECR")!=NULL) {
				//send new items to the nexus by writing to pipe.
				exit(0);
			} else {
				setenv("RCEXECR", pipe-fd);
			}
			after receiving new items, call regenerate(),
			which exit() directly.

Todo:
	zombieskiller (but this need another mapping and lookup)
Something went wrong with that request. Please try again.