Welcome to Linux Forums!

With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.

Linux Forum ArticlesLinux ForumsLinux Forum DownloadsLinux HostsFree MagazinesJobs
Home|Register|FAQ|Member List|Calendar|Unanswered Posts|Forum Rules|Today's Posts|Advanced Search|
SEARCH FOR IN
Go Back   Linux Forums > GNU Linux Zone > Servers
Reload this Page Setting up a cron job?
Linux Forums
Linux Forums
Welcome To The Linux Forums!
Welcome to Linux Forums. We pride ourselves in being one of the largest Linux communities on the web, we encourage you to REGISTER on our forums and participate in the community. There are over 150,000 members ready to answer your questions. JOINING US today will allow you to make new posts, get support, send messages to other members and submit downloads to our downloads directory and many other great features!

Servers Anything server related, Apache, MySQL, Samba, server security, sendmail, exim, etc

Reply
 
Thread Tools Display Modes
Old 06-26-2008   #1 (permalink)
Just Joined!
 
Join Date: Jun 2008
Posts: 13
Setting up a cron job?

Hello,

I've been trying to setup a cron job without any success. I've read quite alot of articles about cron jobs and i've tried so many different variants but nothing seems to work.

Here's the current cron job i've setup:

30 * * * * /usr/bin/php -q /home/a/c/acornmedia/public_html/cron.php > /dev/null

i know the first part is the time i want it to run, (every 30 minutes)
the second part specifies the location of php? (this is where my host told me.)
-q ?? i've no real idea what this does.
this is the path to my live website files.
> ?? not really sure
/dev/null ignores display warnings?

Can anyone spot what i've done wrong?

the cron.php file only has this wrote in:

<?php
mail('example@example.com', 'test message', 'test message');
?>

(i've removed the real address.)

Thanks
copes is offline   Reply With Quote
Old 06-26-2008   #2 (permalink)
Linux Engineer
 
jledhead's Avatar
 
Join Date: Oct 2004
Location: North Carolina
Posts: 805
if you just run this command
Code:
/usr/bin/php -q /home/a/c/acornmedia/public_html/cron.php > /dev/null
does it do what you want?
jledhead is offline   Reply With Quote
Old 06-26-2008   #3 (permalink)
Just Joined!
 
Join Date: Jun 2008
Posts: 13
No, it doesn't seem to do anything.

What permissions do i need to give the cron.php? it currently has 755
copes is offline   Reply With Quote
Old 06-27-2008   #4 (permalink)
Linux Engineer
 
jledhead's Avatar
 
Join Date: Oct 2004
Location: North Carolina
Posts: 805
sorry, what if you run it without the > /dev/null at the end?

how about something like this as a command:
Code:
echo -e "Subject:Status Update\nFrom:SenderAddress <user@domain.com>\n"`cat attachment.txt` | sendmail user@domain.com
or does it have to be the cron.php file?
jledhead is offline   Reply With Quote
Old 06-27-2008   #5 (permalink)
Just Joined!
 
Join Date: Jun 2008
Posts: 13
Well the cron.php file im trying to run is actually just a test file.

I've got a few more complicated php files that i need to run to do hourly/daily tasks on our website.

So i'm just using a very simple php file so i know that the file works, and there shouldn't be any problems with the actual php file.

I've browsed to /usr/bin/ and php is there.

And /home/a/c/acornmedia/public_html/ is the correct path to the web directory, as i've got a php script that uses this path to create backups to the web directory. (and i can browse to the file i want via cd /home/a/c/... etc/cron.php)
copes is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
 

Free Magazines
Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe
Systems Management News, the newspaper for IT systems administration and data center managers!
Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe
The Enterprise Newsweekly
eWeek is the essential technology information source for builders of e-business.
subscribe
Oracle Magazine
Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe
Total Telecom
Total Telecom is "The Economist of the communications industry".
subscribe
More free magazines »



All times are GMT. The time now is 11:03 AM.




© 2000 - 2008 - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.2.0