Post Status Transitions WordPress

function on_all_status_transitions( $new_status, $old_status, $post ) {
    if ( $new_status != $old_status ) {
        // A function to perform actions any time any post changes status.
    }
}
add_action(  'transition_post_status',  'on_all_status_transitions', 10, 3 );

Source: Post Status Transitions « WordPress Codex