cron job not popping up


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting cron job not popping up
# 1  
Old 12-11-2006
Fetchmal email notif. on your prompt (pop, imap, etrn, odmr) [fixed]

Maybe this can help you (I'm refering to the previous post)

This is my question:
=============

1- I am using fetchmail
2- fetchmail allows you to "check" but not "fetch" with the -c flag
3- I thought I'd write a script to check for email, so that I get a text message
on my terminal when I get an email (because it's IMAP)

This is the script:
Code:
#!/usr/bin/env zsh

if echo `fetchmail -c -f ~path/to/my/fetchmailrc`| grep -q 'message'; then
  exit
else

missatge=$(echo `fetchmail -c -f ~path/to/my/fetchmail/fetchmailrc` | gawk '{print "you have "$2" "$3" waiting, my dear..."}')

echo -e "\033[34m\033[1m$missatge"

fi

This is my cronjob:

Code:
0-59/1 * * * * $HOME/bin/fetchmailnotification.sh

I have tested the script and it works just right.

However the cronjob is not showing anything. I thought it could be the > /dev/null or the > /dev/null 2>&1 if you want no e-mail ever.

I've tried removing these > but nothing

I was expecting to be prompted with the notification in my terminal whenever (after checking, say, once per minute, as stated in the cronjob) an email arrives but nothing...

any hint?

thanks

Pau

Last edited by pau; 02-03-2007 at 04:59 PM..
# 2  
Old 12-11-2006
Cronjobs do not have any terminals associated with them. You cannot interact with a cronjob. Infact, the very purpose of cronjobs is to run without any manual intervention.

So do not expect any pop-ups or prompts from your cron job. Cron does not work that way.
# 3  
Old 12-12-2006
ok... nice to learn new things...

I though cron would just run the script as it is and behave as I would expect bit it doesn't...

Do you have a solution then to run the script, say, every 20 minutes?
# 4  
Old 12-12-2006
Quote:
Originally Posted by blowtorch
Cronjobs do not have any terminals associated with them. You cannot interact with a cronjob. Infact, the very purpose of cronjobs is to run without any manual intervention.

So do not expect any pop-ups or prompts from your cron job. Cron does not work that way.
That's right. Anyway you could try something like:
Code:
echo "whatever" | write userX pts/X

Obviously you need to "guess" the terminal, but you can get that info from "who"...
Smilie
Regards.
# 5  
Old 12-12-2006
Hi grial,

that's a promising thing indeed!

now my who yields

Code:
elachistos| who                                                                                                                              
pau      :0           2006-12-12 11:43
pau      pts/0        2006-12-12 11:44 (:0.0)
pau      pts/1        2006-12-12 12:29 (:0.0)
pau      pts/2        2006-12-12 13:54 (:0.0)
pau      pts/4        2006-12-12 13:58 (:0.0)

because I have opened 4 tabs on a terminal...

mmmh... I guess I could define a variable called pts and do a grep on "who" to have sent the message to all terminals... let me try it

thanks for the hint (I wasn't aware of write, by the way! nice BSD tool!)
# 6  
Old 12-12-2006
Mmmh... there's a little problem... write is verbose

Code:
elachistos|                                                                                                                                  
Message from pau@elachistos on pts/2 at 14:20 ...
^[[34m^[[1mhola
EOF

and it doesn't understand the colour encoding (well, that's not very important, but I don't really like the "Message from blabla" and "EOF" ...

from the man it seems it's not possible to make it silent... Smilie
# 7  
Old 12-12-2006
bump...

any heeeelp!!! Smilie please somebody help meeeee

Well... I'd be also happy if somebody could point out a command line email notification system which can deal with IMAP
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Cron job - Need to run Cron every quarter at particular time

Hi, 1) If some job supposed to run on 1st of every month at 7 AM In cron job when we have a blackout on the 1st ( i.e when 1st falls on a sunday ) how can we make the job run the next business day? 2) How can we run a job on 25th of every quarter 7 AM(jan,apr,jul,oct) And if 25th... (5 Replies)
Discussion started by: System Admin 77
5 Replies

2. Shell Programming and Scripting

Commented cron job -- cron monitoring

Hi I have a requirement to write a shell script,that will check the all commented job in cron job.Please help !! (2 Replies)
Discussion started by: netdbaind
2 Replies

3. Solaris

Cron job running even after cron is removed

Hi , I have removed a cron for particular user , but cron job seems to be running even after the cron entry is removed. The purpose of the cron was to sendmail to user ( it uses mailx utility ) I have restarted cron and sendmail service still user is getting mail alerts from the cron job. And... (4 Replies)
Discussion started by: chidori
4 Replies

4. Solaris

cron job starts new cron proccess

I run cron in solaris 10 zone. One cron job which syncing files to nfs mounted on container, creates after finishing another cron proccess(/usr/sbin/cron), and after 100 existing cron proccesses next cron job will not start. It's too weird for me, I'm not able to solve this problem. Theoretically... (3 Replies)
Discussion started by: ron76
3 Replies

5. UNIX for Dummies Questions & Answers

CRON usage for CRON job

can anybody explain the usage of CRON for adding a cron job. please provide an example also for better understanding !!! Thanks (1 Reply)
Discussion started by: skyineyes
1 Replies

6. UNIX for Dummies Questions & Answers

Cron Job

Hi I want to execute a script on the last day of every month. I tried using the following line but it failed: 50 23 * * * && cd live/cgi-bin/;perl org_stats_monthly_cron_job.cgi log shows: CMD: Its a Solaris box. Could someone please help me out? Thanks in advance. (3 Replies)
Discussion started by: tom123
3 Replies

7. UNIX for Dummies Questions & Answers

Cron Job

Hi everybody ....I am trying to write a cron job for event based subscription for a tool called Microstrategy...if anybody have idea about this please help me... Thanks in advance ark (7 Replies)
Discussion started by: arksal
7 Replies

8. UNIX for Dummies Questions & Answers

Cron JOB

I have a cron job that ran for 3 months; all the suden, it stops working. There were no changes in the script. Is there away that I can find out why? can someone with root permission disable my cron-job? Is there away that I can look into the system to see who may have done that? My cron job... (1 Reply)
Discussion started by: bobo
1 Replies

9. UNIX for Dummies Questions & Answers

Cron job

Regarding Cron job, i want to execute a scriptevery 4 days once irrespective of a week or a month. Is it possible?Any help (2 Replies)
Discussion started by: santho
2 Replies

10. Shell Programming and Scripting

Cron job

Hi All , We have few scripts which uses common environment/path setting variables. Now instead of putting classpath , framework,java_home ..... etc. in all the script, can we make a file with all common settings which can be envoked by the scripts while running. If yes , say setting file is... (3 Replies)
Discussion started by: pankajkrmishra
3 Replies
Login or Register to Ask a Question