The way I only allow a controller to be run by the command line is to check if it is a command line request. I validate this in the controller file.
if (!$this->input->is_cli_request()){
//redirect them to the homepage
redirect('', 'refresh');
}else{ //Request is coming from the command line }
To run a controller from a command line on a linux server use a command like this:
/usr/bin/php /var/www/website/index.php controller_name function_name
See this link for more information: http://ellislab.com/codeigniter/user-guide/general/cli.html