1

I am writing script that executes a program, saves it output into a text file, reads that file, and then sends it line by line to a web service.

Is it a good idea to use curl for that, or should I use maybe cat?

  • based on your comment to the below answer, neither - you need to copy the file to the server in some way. The only way cat would would would be netcat and having something listening on the other end. The only way curl would work is to have it send the file as POST data/multi-part-form and have a receiving script process it and save it. You probably just want to scp/sftp/ftps the file over.... – ivanivan Oct 19 '17 at 19:03
2

Text files are... just text files...

If you're creating the file on the same machine as your Web server, then just create the file in it's exact location, inside your Web server file directory hierarchy.

If it's a different machine, then just copy the file into place using sftp or rsync or scp, however you normally copy files between machines.

  • It is different machine. Script will run on machine 1 and output should go to machine 2. – user38974 Oct 19 '17 at 18:18
-1

I think i have a solution. I will ssh terminal output to second machine and be saved as txt and on second machine I will have a script that will read.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.