[oe] Cron job additions from image and package update

Bryan Evenson bevenson at melinkcorp.com
Mon Aug 20 13:21:23 UTC 2012


I am on the 2011.03-maintenance branch of OpenEmbedded.  I have a few cron jobs that I want my device to run, but I am having issues getting updated images to apply the new cron job list.  I would like the cron jobs to be installed for root in the built image and I would also like to be able to update the cron job list through an appropriate package.  I am having problems with both tasks.

First, I have a customized image for my system.  In the image recipe, I am using an addition to the ROOTFS_POSTPROCESS_COMMAND to add my cron job list.  This is what I am doing so far inside my image's Bitbake recipe related to cron:

rootfs_postprocess() {
	# cron: Add cron jobs for our image
	cd ${IMAGE_ROOTFS}
	cd etc
	echo '<text for job 1>' > temp_cron.txt
	echo '<text for job 2>' >> temp_cron.txt
    	echo '<text for job 3>' >> temp_cron.txt
	crontab temp_cron.txt
}

ROOTFS_POSTPROCESS_COMMAND += " rootfs_postprocess; "

When I bitbake my image and look at the resulting filesystem, I see that /etc/temp_cron.txt exists but there are no entries under /var/cron/tabs.  If I burn my new image onto a board, login as root and then call "crontab /etc/temp_cron.txt", then the cron jobs are installed as expected.  I've also tried changing the last line of the rootfs_postprocess function to "crontab -u root temp_cron.txt", but then I get then following error during the image build:

| ERROR: ld.so: object 'libfakeroot.so' from LD_PRELOAD cannot be preloaded: ignored.
| must be privileged to use -u

I assume this is all related to some intricacies of using crontab under fakeroot but I haven't yet found a solution.  Anyone else successfully installing cron jobs on their image?

Also, this would then install the cron jobs on the image but there is no opkg package created that contains the updated cron job list.  I would like to be able to perform an opkg install or upgrade to apply new system settings like this.  Do I need to create a separate recipe so that these system files are included in a package, or is there a ways to do this from my existing image recipe?

Thanks,
Bryan Evenson





More information about the Openembedded-devel mailing list