Thread: Crontab problem

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2006
    Posts
    14
    Rep Power
    0

    Crontab problem


    Hi,
    > i have a problem using the crontab command. i have a program which
    > will show a pop-out in the screen using the say command when the
    > program is run. but when i put the program into the crontab command, the
    > program works perfectly but it did not show any pop-out on the screen.
    > may i know what is the problem here?
    > Thank you for any of your advice.
  2. #2
  3. Not a clue what to put ...
    Devshed Novice (500 - 999 posts)

    Join Date
    Jan 2006
    Location
    in front of this keyboard
    Posts
    834
    Rep Power
    336
    Output normally seen on screen (stdout) will tend to be mailed to your user - check your mail on the server.
    According to Sod's Law, buttered toast lands butter side down, when dropped.
    Per nature, cats always land on their feet.
    So, what happens when you strap buttered toast to the back of a cat and throw it out a window?
    .
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2006
    Posts
    14
    Rep Power
    0
    is there any solutions to make the pop-out appear???
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2006
    Posts
    2,632
    Rep Power
    1811
    One would have to ask why you would want to? Cron is normally used to run jobs when you are not around and they run as terminal-less tasks - why/how/where do you expect any output to go?
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2006
    Posts
    14
    Rep Power
    0
    there will be people around when our program is running, thus when the program detects an error, it will show a pop-out screen using the say command which enable the people near the computer to know that an error has occur in the system.

    is there any solutions???
  10. #6
  11. Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    May 2004
    Location
    Superior, CO, USA
    Posts
    2,419
    Rep Power
    1716
    I've not run across a program run from cron that is interactive. The normal method for something like this that needs to communicate an error is to either send email, page someone, or to log the error. Cron is really designed for "lights out" type of programs, meaning that there isn't expected to be anyone around to watch a screen.
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2006
    Posts
    14
    Rep Power
    0
    is there any ways or solutions to run the program at the specified time and when it finds an error, it prompt out on the monitor saying that there is an error????

    Thank You
  14. #8
  15. Not a clue what to put ...
    Devshed Novice (500 - 999 posts)

    Join Date
    Jan 2006
    Location
    in front of this keyboard
    Posts
    834
    Rep Power
    336
    If you REALLY have to do this, and it sounds like you do - then you could try an echo/print to /dev/console (assuming that is the device file for your console).
    According to Sod's Law, buttered toast lands butter side down, when dropped.
    Per nature, cats always land on their feet.
    So, what happens when you strap buttered toast to the back of a cat and throw it out a window?
    .
  16. #9
  17. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2006
    Posts
    14
    Rep Power
    0
    Originally Posted by Ehlanna
    If you REALLY have to do this, and it sounds like you do - then you could try an echo/print to /dev/console (assuming that is the device file for your console).


    hi,
    where do i put this sentence [echo/print to /dev/console] in? do i put it in at the crontab command or in my program???
  18. #10
  19. Not a clue what to put ...
    Devshed Novice (500 - 999 posts)

    Join Date
    Jan 2006
    Location
    in front of this keyboard
    Posts
    834
    Rep Power
    336
    Put it in the script that you are calling via cron - presumably within an if test to determine of you need the message or not.
    According to Sod's Law, buttered toast lands butter side down, when dropped.
    Per nature, cats always land on their feet.
    So, what happens when you strap buttered toast to the back of a cat and throw it out a window?
    .
  20. #11
  21. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2006
    Posts
    14
    Rep Power
    0
    Originally Posted by Ehlanna
    Put it in the script that you are calling via cron - presumably within an if test to determine of you need the message or not.
    i have put the the sentence but in the mail it keep showing unexpected end of line. this entry has been ignored.
    y isit so??
  22. #12
  23. No Profile Picture
    Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2006
    Posts
    2,632
    Rep Power
    1811
    Having questioned this approach, I suddenly realised that I actually use it myself!
    I have a script that is run by cron (dates/times do not matter), let's call it reminder.sh Within that script I have a section of code:

    Code:
    banner reminder > /dev/console
    So, whenever the specified test succeeds a banner will be produced on the console of the system (first check you DO have a /dev/console device in use!) to remind our Ops to remind me to do something. It only happens at the end of the year, hence me forgetting and hence the need for the script!
  24. #13
  25. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2006
    Posts
    14
    Rep Power
    0
    Originally Posted by SimonJM
    Having questioned this approach, I suddenly realised that I actually use it myself!
    I have a script that is run by cron (dates/times do not matter), let's call it reminder.sh Within that script I have a section of code:

    Code:
    banner reminder > /dev/console
    So, whenever the specified test succeeds a banner will be produced on the console of the system (first check you DO have a /dev/console device in use!) to remind our Ops to remind me to do something. It only happens at the end of the year, hence me forgetting and hence the need for the script!




    hi,
    it work, but can it be directed to print on the screen??
  26. #14
  27. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2006
    Location
    Dublin, Ireland
    Posts
    174
    Rep Power
    48
    I don't know if this will work or not, but it seems to work with the at command.

    Code:
    $ tty
    /dev/pts/13
    $ at -s now
    at> banner bla
    at> <EOT>
    commands will be executed using /bin/sh
    job 1160651424.a at Thu Oct 12 12:10:24 2006
    
    # outputs nothing to the screen
    
    $ at -s now
    at> banner bla > /dev/pts/13
    at> <EOT>
    commands will be executed using /bin/sh
    job 1160651431.a at Thu Oct 12 12:10:31 2006
    $
     #####   #         ##
     #    #  #        #  #
     #####   #       #    #
     #    #  #       ######
     #    #  #       #    #
     #####   ######  #    #
  28. #15
  29. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2004
    Location
    Prague, Czech Rep.
    Posts
    117
    Rep Power
    15
    Originally Posted by ckng
    hi,
    it work, but can it be directed to print on the screen??

    As I can see, you do not like to write to the system console. But what screen do you mean? Perhaps the terminal of some logged-in user? If so, you have to get his terminal's device for instance using the "who" command and then use the "write" command to remind the user. Read the appropriate man pages and try to write the script.

    If you say more details (your Unix, the target user, what to do if he/she is not logged in...) I can perhaps help you.

    Regards zlutovsky

IMN logo majestic logo threadwatch logo seochat tools logo