Page 11 of 20 FirstFirst ... 910111213 ... LastLast
Results 101 to 110 of 191

Thread: How-to for crontab

  1. #101
    Join Date
    Dec 2005
    Beans
    134

    Re: How-to for crontab

    Quote Originally Posted by jake3988 View Post
    Still no

    Thanks though... Trust me, I've tried every combination of everything in the book.
    Really? I tested it and the command worked for me with the full path and display in uppercase... Here's the exact command I ran:

    Code:
    * * * * * export DISPLAY=:0 && /usr/bin/xmessage hi

  2. #102
    Join Date
    Dec 2006
    Beans
    66

    Re: How-to for crontab

    Doing it straight from command-line works fine and it displays in syslog that it fired just fine.

    But it just simply doesn't work from cron. In fact trying to launch anything (like conky for instance) just plain doesn't work.

    Thanks for your help though.

  3. #103
    Join Date
    Dec 2006
    Beans
    66

    Re: How-to for crontab

    I also tried putting the command in an external file and launching that, and that didn't work.

    I tried calling the external file using sh (inside cron) and that didn't work.

    I even tried launching a command using the 'at' command (completely outside of cron) and even THAT didn't work.

    What the heck am I doing wrong that my computer won't let me do absolutely anything dealing with time?

    Edit: I was also told to grep the 'env' command for command, and it turned out to be :0.0, so I tried that and that doesn't work.
    Last edited by jake3988; November 15th, 2008 at 10:39 PM.

  4. #104
    Join Date
    Apr 2007
    Location
    California
    Beans
    110
    Distro
    Kubuntu 9.10 Karmic Koala

    Smile Re: How-to for crontab

    I thank the creator of this post for their specific, succinct, accurate, and lucid explanation of a Linux feature which has entailed a great difficulty for me.
    After reading this post, I finally used this command rightly.
    Linux 2.6.31-20-generic; 9.10 WARNING: Do NOT take this user seriously!
    MSI GD65; i5 750; 4 GB DDR3; GeForce 9500 GT
    : Volume control buttons crash Gnome

  5. #105
    Join Date
    Dec 2005
    Beans
    134

    Re: How-to for crontab

    Quote Originally Posted by jake3988 View Post
    I also tried putting the command in an external file and launching that, and that didn't work.

    I tried calling the external file using sh (inside cron) and that didn't work.

    I even tried launching a command using the 'at' command (completely outside of cron) and even THAT didn't work.

    What the heck am I doing wrong that my computer won't let me do absolutely anything dealing with time?

    Edit: I was also told to grep the 'env' command for command, and it turned out to be :0.0, so I tried that and that doesn't work.
    Have you tried running something non-graphical, to see if maybe that's where the hangup is? Something like

    Code:
    * * * * * /usr/bin/touch /home/[your user]/crontest
    Then you should have a file 'crontest' in your home directory with a modification date of when cron ran...

    If this works, then you'll at least have narrowed it down to something having to do with your graphical system.

  6. #106
    Join Date
    Feb 2008
    Beans
    782
    Distro
    Ubuntu

    Re: How-to for crontab

    I've an issue with the failure messages cron sends out.

    They should be going to root@laptop but they end up in:
    Code:
     /var/mail/nobody
    instead of root's mailbox.

    I've a few cron errors going to
    Code:
    /var/mail/<my username>
    and those are ok. Well i can deal with them using alpine.

    where do i change the email so it sends it to my username or root instead of going to nobody? (which i assume is due to the fact that root is dissabled as a logon user).
    Laters...
    Sol
    "Have you found the secrets of the universe? Asked Zebade "I'm sure I left them here somewhere" User numbers: Ubuntu 23772 Linux 477911

  7. #107
    Join Date
    Dec 2005
    Beans
    134

    Re: How-to for crontab

    Quote Originally Posted by solitaire View Post
    I've an issue with the failure messages cron sends out.

    They should be going to root@laptop but they end up in:
    Code:
     /var/mail/nobody
    instead of root's mailbox.

    I've a few cron errors going to
    Code:
    /var/mail/<my username>
    and those are ok. Well i can deal with them using alpine.

    where do i change the email so it sends it to my username or root instead of going to nobody? (which i assume is due to the fact that root is dissabled as a logon user).
    So you are using the root crontab ('sudo crontab -e') for the cron errors you want to redirect? If so, you should be able to redirect them to another e-mail address by appending
    Code:
    MAILTO=user@domain
    to the crontab.
    Last edited by chenel; November 24th, 2008 at 06:53 PM.

  8. #108
    Join Date
    Jul 2007
    Location
    Bristol, UK
    Beans
    215
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: How-to for crontab

    Thanks for such a brilliant how-to.

    Maybe this is a silly question, but I'd be very grateful if one of the many gurus on this forum could confirm this for me...

    As I understand it:

    Code:
    0 * * * * * command > /dev/null 2>&1 #Comment
    should send STDOUT and STDERR to null and thus supress all emails. Whereas:

    Code:
    0 * * * * * command > /dev/null #Comment
    should send only STDOUT to /dev/null. Would STDERR still go to an email in this case? And would I, therefore, get an email if the job failed?

  9. #109
    Join Date
    Dec 2005
    Beans
    134

    Re: How-to for crontab

    Quote Originally Posted by yknivag View Post

    Code:
    0 * * * * * command > /dev/null #Comment
    should send only STDOUT to /dev/null. Would STDERR still go to an email in this case? And would I, therefore, get an email if the job failed?
    I believe that you're essentially correct, but CRON doesn't produce output that goes to STDERR (or STDOUT, for that matter). Instead, I think you'd only get an e-mail if 'command' produces some output that is sent to STDERR.

  10. #110
    Join Date
    Nov 2008
    Beans
    18

    Re: How-to for crontab

    I can't get crontab to work under su.

    I've setup a script to run under my normal login and it works ok. However, when I change to root and use exactly the same cron parameters, it doesn't trigger.

    the cron I use in both instances is:

    35 23 * * * python /home/myname/test.py

    The test.py file creates a txt doc with the current date and time. I've tried moving the test.py file out into the /tmp/ directory but that doesn't make any difference. I've changed the permissions on the file for all to read and write.

    Am I just stupid?

Page 11 of 20 FirstFirst ... 910111213 ... LastLast

Tags for this Thread

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
  •