Find the answer to your Linux question:
Results 1 to 7 of 7
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie
    Join Date
    Jan 2017
    Location
    Zambia
    Posts
    110

    Banging my head against CRON


    I'm trying to set up a cron job to speedtest my broadband every 15 mintues. I just cannot get the cron running - I've had a lot of goes at this, followed a few tutorials, and I just can't get it to work. I'm presuming I'm doing something stupid.

    Linux Mint Mate 64.

    I've edited /etc/crontab and included the timing and shell command (the command does work when I try it directly in a terminal)

    Code:
    # /etc/crontab: system-wide crontab
    # Unlike any other crontab you don't have to run the `crontab'
    # command to install the new version when you edit this file
    # and files in /etc/cron.d. These files also have username fields,
    # that none of the other crontabs do.
    
    SHELL=/bin/sh
    PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
    
    # m h dom mon dow user  command
    17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
    25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
    47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
    52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
    #
    */15 * * * * /usr/bin/speedtest-csv --server=10335 >> /home/jason/Desktop/speedtestresults.csv
    I don't think the crond daemon is running:

    Code:
     jason@JasonVostro /etc $ ps aux | grep crond
    jason     5358  0.0  0.0  14228   932 pts/0    S+   14:47   0:00 grep --color=auto crond
    Trying to start crond manually:

    Code:
    jason@JasonVostro /etc $ crond
    No command 'crond' found, did you mean:
     Command 'cron' from package 'cron' (main)
    crond: command not found
    Trying to start cron:

    Code:
    jason@JasonVostro /etc $ cron
    cron: can't open or create /var/run/crond.pid: Permission denied
    Code:
    jason@JasonVostro /etc $ sudo service cron reload
     * Reloading configuration files for periodic command scheduler cron
    I think the above means cron is running..?

    Maybe there's just something fundamental that I don't understand about cron - any one able to help me get this working?

    Thanks.

  2. #2
    Linux Guru Segfault's Avatar
    Join Date
    Jun 2008
    Location
    Acadiana
    Posts
    1,909
    Why are you using system crontab without user name? You should use your user crontab instead.
    Code:
    crontab -e
    Do not run this command as root unless you really know what you are doing.

  3. #3
    Linux Newbie
    Join Date
    Jan 2017
    Location
    Zambia
    Posts
    110
    Hi Segfault, thanks for the reply.

    Done that as well. As it stands now I have my own crontab for my user. If I do crontab -l it lists my job, but the job is still not running.

    Code:
    jason@JasonVostro ~ $ crontab -l
    # For example, you can run a backup of all your user accounts
    # at 5 a.m every week with:
    # 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
    # 
    # For more information see the manual pages of crontab(5) and cron(8)
    # 
    # m h  dom mon dow   command
    */15 * * * * /usr/bin/speedtest-csv --server=10335 >> /home/jason/Desktop/speedtestresults.csv # JOB_ID_1
    I downloaded gnome-scheduler, a front end for cron, and I can see my job is there - it even allows me to do a one-time run of the job to test it, and it works, but it's still not running on schedule. I'm completely at a loss as to why.

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru Segfault's Avatar
    Join Date
    Jun 2008
    Location
    Acadiana
    Posts
    1,909
    What is the speedtest-csv? Is it a script?

  6. #5
    Linux Newbie
    Join Date
    Jan 2017
    Location
    Zambia
    Posts
    110
    It's a script that calls a Python script called speedtest-cli

    It's set to be executable. The full command runs correctly from the terminal, and when I force the cron job to run using gnome-scheduler, it runs.

    What it doesn't do is run on schedule. As I said in my opening post, I'm not sure crond is running but I don't know why or how to get it running (or in fact whether it needs to)

  7. #6
    which version of linux mint?
    shouldn't you be using systemd timers instead?
    I am not a "Linux Guru"! Get off me! The Forum software won't let me change it!
    How to ask smart questions | Don't be a Help Vampire | How to Use Code Tags
    You can post a link by removing "http://www." from it.

  8. #7
    Linux Newbie
    Join Date
    Jan 2017
    Location
    Zambia
    Posts
    110
    The mint tutorials seems to say using CRON is the way to go. I'm asking my question in the mint forums as well. Thanks.

    Mint 18.1 serena, 64-bit. Fairly new but not bleeding edge.

Posting Permissions

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