Results 1 to 4 of 4

Thread: Problem with Crontab and a speedtest script

  1. #1
    Join Date
    Apr 2014
    Beans
    3

    Problem with Crontab and a speedtest script

    Hi everybody, i've a problem with the periodic execution of a speedtest script through crontab.
    I've wrote the following script invoking the speedtest-cli script, the script is the following:
    speed_script.sh
    Code:
    #!/bin/shdate >> /home/user/speedtest.log
    speedtest-cli --simple >> /home/user/speedtest.log
    echo "" >> /home/user/speedtest.log
    Then i've edited the crontab configuration file (crontab -e) with the following line, in order to test and write down the network speed every half an hour:
    Code:
    0,30 * * * * /home/user/speed_script.sh
    So, the resulting file speedtest.log only contains the date of the tests, without the internet speed results.

    If I run the script manually from terminal, the script runs correctly and the speedtest.log contains the date anche the speedtest output.
    Where's the mistake?
    Thanks everybody...

    This is the output file with crontab:
    Code:
    Tue Apr 29 11:00:53 CEST 2014
    Download: 4.84 Mbits/s
    Upload: 0.47 Mbits/s
    
    Tue Apr 29 11:30:45 CEST 2014
    Download: 3.89 Mbits/s
    Upload: 0.38 Mbits/s
    And this with the manual execution:
    Code:
    Tue Apr 29 11:47:11 CEST 2014
    
    Tue Apr 29 11:51:32 CEST 2014
    
    Tue Apr 29 11:55:08 CEST 2014
    P.S. Sorry for my english, but it's not my native language...
    Last edited by marco39; April 30th, 2014 at 01:53 PM. Reason: solved

  2. #2
    Join Date
    Aug 2011
    Location
    47°9′S 126°43W
    Beans
    2,172
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Problem with Crontab and a speedtest script

    Where is the "speedtest-cli" executable and is that in the execution path of whatever runs the cron jobs? Ddi you try to give a full path to it in the script?
    Warning: unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.

  3. #3
    Join Date
    Apr 2014
    Beans
    3

    Re: Problem with Crontab and a speedtest script

    First thing: I began to study and use crontab only yesterday, so I know very little .
    I installed speedtest via pip using the command pip install speedtest-cli so i don't know where the executable is. I tried to look it up in /usr/bin but unsuccessfully.
    Then i use locate speedtest-cli and the result is /usr/local/bin/speedtest-cli.So i modified the script including the full path of speedtest-cli... and now seems to work!
    Now i do some tests...
    For now thank you so much!

  4. #4
    Join Date
    Apr 2014
    Beans
    3

    Re: Problem with Crontab and a speedtest script

    Alla seems working.. Thank you!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •