LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-02-2009, 02:32 PM   #1
wakeboarder3780
Member
 
Registered: Mar 2006
Distribution: Ubuntu 6.10
Posts: 112

Rep: Reputation: 15
cron newbie - getting simple echo script to run


Hello all. I have the following entries in my crontab file:

Code:
$ echo $USER
n0167700

$ cat /var/cron/tabs/n0167700
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.x4nApCt00U installed on Mon Mar  2 13:25:19 2009)
# (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie Exp $)
* * * * *       echo hello

* * * * *       `echo hi`
Is there something special I have to do to make cron start executing jobs? Or is it supposed to happen once every minute from the second you install cron?
 
Old 03-02-2009, 02:43 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Should happen every minute ... Thing is you'll only see something in
either the cron log or in your mail, because cron will run this in
the back-ground, not in one of your open terminals.
 
Old 03-02-2009, 02:57 PM   #3
wakeboarder3780
Member
 
Registered: Mar 2006
Distribution: Ubuntu 6.10
Posts: 112

Original Poster
Rep: Reputation: 15
This yields no logs:
Code:
* * * * *       `echo hi` > ~/cron.backtic.echo.log

* * * * *       echo hello > ~/cron.normal.echo.log
 
Old 03-02-2009, 03:00 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Try
Code:
* * * * *       /usr/bin/echo hello > /tmp/cron.normal.echo.log
Also check /var/log/messages and /var/log/cron
 
Old 03-03-2009, 09:38 AM   #5
wakeboarder3780
Member
 
Registered: Mar 2006
Distribution: Ubuntu 6.10
Posts: 112

Original Poster
Rep: Reputation: 15
Yeah putting the full path in worked great. I also changed it to append to the log and I can now see it's being appended every minute. I should be able to go from here. Thanks (I feel a little sheepish )
 
Old 03-03-2009, 01:57 PM   #6
T74marcell
Member
 
Registered: Mar 2009
Posts: 102

Rep: Reputation: 18
If you want to avoid both stdout and stderr feedback, then use this:
Quote:
* * * * * /usr/bin/echo hello 2>&1 >/dev/null
2>&1 will redirect stderr to stdout, and stdout is in turn redirected to /dev/null.
The echo tool usually will not produce stderr feedback, but other applications can.

----------
T74marcell

Arch Linux

Last edited by T74marcell; 03-14-2009 at 01:38 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Script not being run in cron.daily hazmatt20 Linux - General 10 10-12-2008 09:24 PM
simple "echo > qbc" cron jobs doesn't run shole Linux - Newbie 3 09-23-2006 03:09 PM
cannot get tu run a php script in cron alain Linux - General 6 02-06-2006 03:54 AM
can't get cron to run my script. dr_zayus69 Linux - Software 6 04-12-2005 07:34 PM
can echo be used for popups in shell scripts run by cron? dr_zayus69 Linux - Software 4 04-12-2005 07:30 PM


All times are GMT -5. The time now is 04:04 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration