LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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, 01: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, 01:36 PM   #2
rocket357
Member
 
Registered: Mar 2007
Location: 127.0.0.1
Distribution: OpenBSD-CURRENT
Posts: 476
Blog Entries: 121

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


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


All times are GMT -5. The time now is 07:31 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration