Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Apr 2003
Posts: 359
Enthusiast
Enthusiast
Joined: Apr 2003
Posts: 359
UBB.Threads v6.4
Server: Linux
----------------

I would like learn how to set up a Cron Task. I have gone into Infopop's site and found this: http://www.ubbcentral.com/resources/cron.html Now, this has not really helped so far. I'm looking at my w3tvars.pm and I'm stuck on setting up the variables in this file. I wish there were some examples already written in this file so knuckle-heads like myself could better understand what we are to input.

I greatly appreciate any assistance/guideance with setting up Cron Tasks.

Sponsored Links
Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
Why not use the PHP subscriptions file. You do not need to worry about w3tvars.pm Just go to the cron/php/subscriptions .php file and set the path to main.inc.php You can then enter the cron ask as per your server's way of doing it. Alot of the good server providers allow you to set a cron task in your control panel. Some you need to hand edit the cron file. Then others the host will need to set themselves.

As far as commenting on other forum software as I own Vbulletin and have tried PHPBB setting up a cron task is always a server issue so I do not know which kind of correlation you are trying to make. Bulletin Board software does not set any cron task.

Joined: Apr 2003
Posts: 359
Enthusiast
Enthusiast
Joined: Apr 2003
Posts: 359
Thanks Chuck. As for the correlation I was making...I had gotten Cron Tasks confused with something else.... I edited my post as well in regards to that as well.

Yes, I have a dedicated server and have the option of setting up Cron Tasks within my cPanel. Just never used it nor do I know how....

I'll look into the .php file you metioned and see if I can get things going.

Thanks.

Joined: Apr 2003
Posts: 359
Enthusiast
Enthusiast
Joined: Apr 2003
Posts: 359
Okay, I edited the path to the main.inc.php in the subscriptions.php file and went into my cPanel to set up the Cron Task. Problem is, I don't know if I got it set right. Is there anyway to test the Cron Task to verify it's working?

I added the subscription.php to the task.

I put the path to run the Cron Task as:

/home/gonzo/public_html/ubbthreads.com/cron/php/subscriptions.php

Or, does the path to run this task need to be:

root /home/gonzo/public_html/ubbthreads.com/cron/php/subscriptions.php

I'm testing this on my test site to ensure it works first.

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
Nope /home/gonzo/public_html is correct if I remember correctly for you server.

Cpanel is easy. It lets you choose how often to run it from drop down boxes basically

I run my subscriptions task at 2am. To test yours you could go back in and edit your subscriptions cron and set the time to 5 mins later than it is when you edit it and wait 5 mins and check mail

When your finished and satisfied simple edit the cron and set the final daily time to run it. Or you can play lazy and wait till it is suppose to run like you have it set

Sponsored Links
Joined: Apr 2003
Posts: 359
Enthusiast
Enthusiast
Joined: Apr 2003
Posts: 359
Hahahahaa.....right on....thanks Chuck!

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
You're probably going to need to specify the path to php.

On a Cpanel server is should be

/usr/bin/php and a space inserted before the command.

So the cron entry should be:
Code
<br />/usr/bin/php /home/gonzo/public_html/ubbthreads.com/cron/php/subscriptions.php<br />


In Cpanel, if you use the advanced setup tab, you can specify an email address at the top. Then you'll get an email when the cron runs. This is handy to make sure it worked and to see if there were any errors.

Hope that helps.

Joined: Apr 2003
Posts: 359
Enthusiast
Enthusiast
Joined: Apr 2003
Posts: 359
[]JoshPet said:
You're probably going to need to specify the path to php.

On a Cpanel server is should be

/usr/bin/php and a space inserted before the command.

So the cron entry should be:
Code
<br />/usr/bin/php /home/gonzo/public_html/ubbthreads.com/cron/php/subscriptions.php<br />


In Cpanel, if you use the advanced setup tab, you can specify an email address at the top. Then you'll get an email when the cron runs. This is handy to make sure it worked and to see if there were any errors.

Hope that helps. [/]

I used the command line as you thought it should be Josh and I don't believe it's working. I've not gotten any emails sent to me from the server letting me know that the Cron Task has been run and I've had it this way for over about a week now.

Hmmmm....back to the drawing board....

Joined: Apr 2003
Posts: 359
Enthusiast
Enthusiast
Joined: Apr 2003
Posts: 359
Does this sound correct which I've found on UBB Central Resources. Seems weird though because it's sending you to the php directory for the Cron Task but it sends you to the Perl version of the file which is not in the php directory...it's in the Perl directory. Yea, I'm confused again...

[]
3. If you are using the subscriptions feature (users can subscribe to forums), then you need to set up the cron task to run subscriptions.pl nightly. You need to edit /etc/crontab so the script will run nightly. Something like the following will work on most systems.

0 1 * * * root /home/httpd/html/ubbthreads.com/cron/php/subscriptions.pl [/]

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
That looks correct for the Perl cron task.... above you said you were using the PHP version.

What I posted above is what you'd most likely need to put on a cpanel server using the php cron job.

I've done it on dozens of Cpanel sites.

Sponsored Links
Joined: Apr 2003
Posts: 359
Enthusiast
Enthusiast
Joined: Apr 2003
Posts: 359
Okay Josh....like I posted though...I used that same command and no go.

Must be some boo-boo I made along the line... I'll reverify everthing.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Did you use this command:

/usr/bin/php /home/gonzo/public_html/ubbthreads.com/cron/php/subscriptions.php

The one you posted was for the perl task.

Also make sure you edit the path at the top of the subscriptions script.

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
You still need something like this before the path to the cron task

0 1 * * *

This tells the cron when to run.

Josh's probally does not work as while it might be right you need to specify the path to php on some servers. Are you giving the file a time to run? This may be your problem.

Mine you do not you have do the 0 2 * * * /path/to/file.php

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
He would if he were doing it directly - but he's got CPanel. It's point and click to set the time fields, he just needs to pick the time and plug that line I gave him in the command area. Cpanel takes care of the other part. If you put that extra stuff in the command field in Cpanel it won't work.

And you have to have /usr/bin/php(space) before the path.

Joined: Apr 2003
Posts: 359
Enthusiast
Enthusiast
Joined: Apr 2003
Posts: 359
Okay, I checked the paths in the subscriptions.php file and I did notice one spelling error. That may have been all it was.

Also, I went into my WebHost Manager to verify the server settings and I've set the Cron Task to run a few minutes later than what the server time is set at this moment so I can test this out.

And Josh is correct...with cPanel it's nice...you can use the Standard or Advanced (Unix Style) for setting up Cron Tasks.

*fingers crossed...

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
If you still have trouble, rung subscriptions.php in your browser and see if it throws any errors.

If it returns a totally blank page, then it worked.

Joined: Apr 2003
Posts: 359
Enthusiast
Enthusiast
Joined: Apr 2003
Posts: 359
Okay, so running it from the browser would be, if I'm not all screwed up here:

http://www.f-bodyhideout.com/ubbthreads/cron/subscriptions.php

HTTP 404 Not Found

And I get a page cannot be found.

The file is in ubbthreads/cron/subscriptions.php

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369

Joined: Apr 2003
Posts: 359
Enthusiast
Enthusiast
Joined: Apr 2003
Posts: 359
Doh!

Okay, helps that I do put the correct path in the browser...forgot the php directory.

And yes it did return a blank page, but I'm not getting an email to let me know it ran.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Well if it runs that way you won't get an email telling you it ran.

Cpanel has an option (advanced tab) to send an email to an address when the cron job runs.

Joined: Apr 2003
Posts: 359
Enthusiast
Enthusiast
Joined: Apr 2003
Posts: 359
[]JoshPet said:
Well if it runs that way you won't get an email telling you it ran.

Cpanel has an option (advanced tab) to send an email to an address when the cron job runs. [/]

Yea, and I've had it set up as a Cron Task in cPanel with my email to send me when it runs. I had it set up as well as a Cron Task to run and I've changed the time more than a dozen now testing it out...but I still do not get emails nor am I getting the 5 Subscriptions I set up in My Home.

Thanks Josh for hanging in there with me helping out on this one.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Then there may be a server issue with cron tasks not working? Hrm... I dunno.

You should get an email either way when they run.

I've got 50 or 60 of them a night as notification for all my cron tasks.

Joined: Apr 2003
Posts: 359
Enthusiast
Enthusiast
Joined: Apr 2003
Posts: 359
Yea....I'm confused....but that's not unusual.


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)