What's wrong with my code

Ok, so I have some code that's pretty much copied from the wordpress site for adding a cron function and put in a plug-in but it doesn't seem to be working. Can someone tell me what I did wrong?

Here's the code that's in one of the plugin files

//add our hourly cron
add_action( 'ca_cron_hook', 'ca_my_custom_function' );

function ca_cron_init() {
	if ( !wp_next_scheduled( 'ca_cron_hook' ) ) {
		wp_schedule_event( time(), 'hourly', 'ca_cron_hook' );
add_action( 'wp', 'ca_cron_init' );

function ca_my_custom_function() {

The ca_my_custom_function works as I can make a call to it in the settings page (and the function make a call to a wordpress function that makes a change to the database which I can verify.) So if the function works when I call it manually, then I think the problem must be with my code creating the cron, but I can't see what that is.