Cron job not working

There are 14 replies in this Thread which was already clicked 1,374 times. The last Post () by ferdi.

  • hi guys


    messng with a ubuntu server with oscam only, got it all working with a check script which works manually but when i enter it as a cron job it doesn't run


    i did crontab -e logged in as root, entered the below line and saved and exit, when i do crontab -l it shows the line fine


    Code
    */2 * * * * root /usr/local/bin/oscheck


    set it for 2 mins for testing and it doesn't seem to run


    any ideaS?

  • 1) clear all in: crontab -e
    2) put the same line in /etc/crontab
    (edit with nano /etc/crontab)


    (just like advised yesterday :36_002: )

  • 20 5 * * * root reboot


    This will restart every night at 05:20

  • 1) clear all in: crontab -e
    2) put the same line in /etc/crontab
    (edit with nano /etc/crontab)


    (just like advised yesterday :36_002: )


    thanks mate


    have tried this and still doesn't work


    then did dos2unix and wala! started working


    damn windows formatting!!!


    thanks mate

  • I tested on my Raspberry, but unfortunately it doesn't work


    P.S. path= /etc/crontab


    This is written for Debian/Ubuntu.. And will not (per se) work on other systems.


    On raspberry and most system you can do: crontab -e, and insert the line there.
    Did you test the script by manually running it ?

  • I tested on my Raspberry, but unfortunately it doesn't work


    P.S. path= /etc/crontab



    in putty session type


    sudo crontab -e


    then in the editor, add your task - make sure you are scrolling down to a new line after all the instructional text so there are no hashes before your line, then add your task


    save the task by ctrl alt and x - and answer yes to save.

    If I take a while to respond, you can see why.....


    :red:


  • I followed the instructions:
    - sudo crontab -e
    - add last line 30 22 * * * root reboot
    - ctrl and x
    - save /tmp/crontab.gdyo5z/crontab
    - yes
    but doesn't work

    together we grow - ferdi

  • are you rebooting after editing? have can you see cron as a task on startup? Have you checked the crontab file to ensure that the edit has saved?

    If I take a while to respond, you can see why.....


    :red:

  • Revisiting this - I had to the /etc/crontab on the raspberry pi - as root - I did this in an editor (not notepad of course!) - and accessed the file from winscp - ofcourse you can use nano to do this.

    If I take a while to respond, you can see why.....


    :red:

  • You don' t want sudo in your crontabs as it will ask for a password and fail because there will be no keyboard to attach to the process.


    this is the correct statement:

    Quote

    sudo crontab -e


    30 18 * * * /sbin/shutdown -r now

    together we grow - ferdi

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!