in reply to Re: Running speedtest-cli with Perl and cron
in thread Running speedtest-cli with Perl and cron

Cool!

I like the use of print join and I will add this to my script.

This is the crontab line I use for appending the results in the same file, I also added an \n to my script to make a new line for each test. I don't see the need for throwing this into a .csv or such, so the notepad will suffice.

What's the best practice for writing to file? Should the file be written by the script, or is it okay to do this with crontab?

* */12 * * * /usr/bin/perl /bin/speedtest.pl >> /storage/documents/cron/speedtest/speedtest.txt 2>&1

You guys are awesome! I've never encountered a forum where people answer this fast, and all the response is helpful. I'm going to be a lot on this website henceforth :-)

Replies are listed 'Best First'.
Re^3: Running speedtest-cli with Perl and cron
by NetWallah (Canon) on Dec 12, 2014 at 21:48 UTC
    ... best practice for writing to file
    My preference is for the program/script to send output to STDOUT. Externally (as you have done it), this is directed to a user-specified location, which could well be a socket to a different machine, plumbed into a pipe, or dispersed somewhere cloudy or smoggy.

            "You're only given one little spark of madness. You mustn't lose it."         - Robin Williams