Q:

Unwanted text file is creating while calling a URL through Cron

In our application we are configured number of Cron jobs for running some routine tasks.We are working on Ruby on Rails. I will provide the flow we are using.
crontab 
*/2 *    * * *   user  sh file_path/test.sh

test.sh
wget https://domain.com/url/key

routes.rb
post "/url/:key" => "cron_job_controller#action"

cron_job_controller.rb
def action
   if params[:key] && params[:key] == "key"
      ---do some actions----
   end
   respond_to do |format|
      format.html {render :status => Rack::Utils.status_code(:ok), :nothing => true}
   end
end

The job is getting executed and all the process is completing successfully. but after getting response 200 an unwanted text file is getting generated with name as the value of key we are passing in the home folder. for example key,key.1,key.2,etc..... Providing the console result below.
LAP-PS009:~/work$ sh file_path/test.sh 
--2015-02-13 14:58:16--  http://localhost:3000/url/key
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:3000... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: `key'

[ <=>                                    ] 1           --.-K/s   in 0s      
2015-02-13 14:58:18 (89.3 KB/s) - `key' saved [1]

Because of this we have to monitor and remove these unwanted files manually. So I am requesting to suggest a permanent solution for this problem. Waiting for the replays. Thanks in advance.

A:

Whether you need just to pick up an API endpoint, you might use curl with respective CRUD action (POST/PUT/DELETE).
Once you are stuck to wget, do the following:
wget https://domain.com/url/key -o /dev/null -O /dev/null

The above will redirect an output to nowhere preventing you directory from being garbaged.

