LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > *BSD
User Name
Password
*BSD This forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.

Notices


Reply
  Search this Thread
Old 04-15-2009, 12:33 PM   #1
paragkalra
Member
 
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.
Quote:
#!/bin/sh
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
Quote:
* * * * * /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
rocket357
Member
 
Registered: Mar 2007
Location: 127.0.0.1
Distribution: OpenBSD-CURRENT
Posts: 485
Blog Entries: 187

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

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

or like this:

/usr/home/parag/mydate

?

If the second one, does the first one work?
 
  


Reply

Tags
crontab, freebsd, shell



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

LinuxQuestions.org > Forums > Other *NIX Forums > *BSD

All times are GMT -5. The time now is 12:17 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
Open Source Consulting | Domain Registration