Help answer threads with 0 replies.
Go Back > Forums > Other *NIX Forums > *BSD
User Name
*BSD This forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.


  Search this Thread
Old 04-15-2009, 12:33 PM   #1
Registered: Sep 2006
Location: Nagpur, Maharashtra, India
Distribution: Debian, Ubuntu, Redhat, Fedora, SLES, OpenSUSE, FreeBSD, Mac OS X
Posts: 221

Rep: Reputation: 31
Shell script not working through crontab

I have written following script.
mydate=`/bin/date | /usr/bin/cut -f 3 -d " "`
/bin/echo $mydate >> /usr/home/parag/date.txt
I am running this through crontab as a non root user:
$crontab -l
* * * * * /usr/home/parag/mydate > /dev/null 2>&1
The script executes but "date.txt" is empty when it runs through crontab. However on manually running the same script the date is getting appended to the "date.txt" file.

I am using FreeBSD 7.0

Any pointers.
Old 04-15-2009, 12:36 PM   #2
Registered: Mar 2007
Distribution: OpenBSD-CURRENT
Posts: 485
Blog Entries: 159

Rep: Reputation: 74
Are you manually running it like this:

/usr/home/parag/mydate > /dev/null 2>&1

or like this:



If the second one, does the first one work?


crontab, freebsd, shell

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
my database export shell script run from command line but not form crontab saifee Linux - General 11 01-29-2012 09:24 AM
how to run crontab in shell script panselva Linux - General 3 05-08-2008 08:33 PM
shell script works form command line but not form crontab saifee General 1 10-14-2004 10:27 AM
Shell script running via crontab problem. thetruethugg Linux - Software 13 12-19-2003 08:56 PM
adding a job to crontab via shell script tazio Linux - General 7 10-23-2003 02:44 PM

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

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