Webcalendar cron problems


#1

I’ve got a bit of a problem, I’ve installed webcalendar from the one click installs, and everything is going fine so far, but in order to have it send reminders I need to install a cron job for it… specifically I need to run send_reminders.php on a regular basis. After looking up the procedure (yes, I am a noob), I went into the goodies/cron jobs section, and created a job…

/usr/local/php5/bin/php /home/user/mydomain.com/webcalendar/tools/send_reminders.php placing the correct user name, and domain name in the string.

Nothing happened when I tested the calendar (no reminder emails), so I set the cron job to run every five minutes, and send an email of the errors, and this is the resulting message:

Warning: require_once(…/includes/classes/WebCalendar.class): failed to open stream: No such file or directory in /home/user/mydomain.com/webcalendar/tools/send_reminders.php on line 59

Fatal error: require_once(): Failed opening required ‘…/includes/classes/WebCalendar.class’ (include_path=’.:/usr/local/lib/php:/usr/local/php5/lib/pear:…/includes:’) in /home/user/mydomain.com/webcalendar/tools/send_reminders.php on line 59

I am able to telnet into a shell, and directly run php send_reminders.php, and it will then send out the reminder e-mails, so this one has me pulling my hair out.

Webcalendar does send email notifications when an event is created, I just can’t make this cron job thing work :frowning:

Thanks in advance.


#2

Does WebCalendar.class exist?

What if you point your browser to http://example.com/webcalendar/tools/send_reminders.php ?
Will that trigger the sending? If so, then you can use cron to trigger it as a web browser:

/usr/bin/wget -o /dev/null http://example.com/webcalendar/tools/send_reminders.php

That’ll trigger and send all output to /dev/null (silent output). You can leave the “-o /dev/null” off for testing so you can see any errors, then put it back if you know it’s working.


#3

Hi sdayman, thanks for answering.

Yes, it exists in the /example.com/webcalendar/includes/classes directory.

It didn’t do anything, blank page and no reminder :frowning:

Interesting output from this command:

–2010-08-01 13:06:01-- http://example.com/webcalendar/tools/send_reminders.php
Resolving example.com… xx.xxx.xxx.xx
Connecting to example.com|xx.xxx.xxx.xx|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 0 [text/html]
Saving to: `send_reminders.php’

 0K                                                        0.00 =0s

2010-08-01 13:06:01 (0.00 B/s) - `send_reminders.php’ saved [0/0]

Not sure what it did there, but unfortunately it did not send a reminder.

Thanks again for the advice, if you have any more idea’s I would love to try them out.


#4

When you went into the shell to run send_reminders.php, what was the exact command you used? Can you try that same command, but instead of send_reminders.php, how about a -v instead so we can see which version you ran?


#5

php send_reminders.php

This is what I get from php -v:

php -v
PHP 5.2.14 (cli) (built: Jul 22 2010 10:26:17)
Copyright © 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright © 1998-2010 Zend Technologies
with Zend Extension Manager v1.2.2, Copyright © 2003-2007, by Zend Technologies
with Zend Optimizer v3.3.9, Copyright © 1998-2009, by Zend Technologies

Thanks again.


#6

How about trying the same cron command, but in command line?
/usr/local/php5/bin/php /home/user/mydomain.com/webcalendar/tools/send_reminders.php


#7

I was trying it just before you wrote your reply :slight_smile:
I got the exact same error as the original message.

Also, when running the command php send_reminders from it’s directory, there is no error, but it no longer sends reminders (which it did before).


#8

If command line “php send_reminders.php” did work from that tools directory, then change your cronjob to:
cd /home/user/mydomain.com/webcalendar/tools ; php send_reminders.php


#9

sh: php: command not found

I had high hopes for this one.

edit: here is the message subject if that helps - Cron user@haddock /usr/local/bin/setlock -n /tmp/cronlock.3907488.82148 sh -c $'cd /home/user/mydomain.com/webcalendar/tools \073 php send_reminders.php ’


#10

I’m wondering if the Panel mechanism for cronjobs messes up the semicolon. Maybe putting the whole thing in quotes will fix that.

OR

Double-check that your:
php send_reminders.php works. If so, immediately after that, type “which php” without the quotes. If it’s different from the full path we tried earlier, try updating your original cronjob.

OR

Can you also double-check that the cronjob is running as the same user as you used to log in and run the command on the command line?

OR

Another approach would be to not set up this cronjob from the panel and do it manually from the command line. Here’s they very long wiki entry on manually working with cron:
http://wiki.dreamhost.com/Cron


#11

same error:

sh: cd /home/user/example.com/webcalendar/tools/ ; php send_reminders.php: No such file or directory

It worked one time yesterday, but no longer functions. which php returns:
/usr/local/bin/php which is not the same.

After updating the cronjob it gave the error:

Warning: require_once(…/includes/classes/WebCalendar.class): failed to open stream: No such file or directory in /home/user/example.com/webcalendar/tools/send_reminders.php on line 59

Fatal error: require_once(): Failed opening required ‘…/includes/classes/WebCalendar.class’ (include_path=’.:/usr/local/lib/php:/usr/local/php5/lib/pear:…/includes:’) in /home/user/example.com/webcalendar/tools/send_reminders.php on line 59

It is, and it didn’t send a reminder

I’ll try that.


#12

I created a crontab manually (I think it’s correct) by creating a text file called remind.txt using notepad++

MAILTO=user@example.com
#!/usr/local/bin/php -q
*/5 * * * * /usr/local/php5/bin/php /home/user/example.com/webcalendar/tools/send_reminders.php

and changed it after the first one failed to:

MAILTO=user@example.com
#!/usr/local/bin/php -q
*/5 * * * * /usr/local/bin/php /home/user/example.com/webcalendar/tools/send_reminders.php

Both returned the errors:
Warning: require_once(…/includes/classes/WebCalendar.class): failed to open stream: No such file or directory in /home/user/example.com/webcalendar/tools/send_reminders.php on line 59

Fatal error: require_once(): Failed opening required ‘…/includes/classes/WebCalendar.class’ (include_path=’.:/usr/local/lib/php:/usr/local/php5/lib/pear:…/includes:’) in /home/user/example.com/webcalendar/tools/send_reminders.php on line 59

This is really wierd considering that it worked one time from the command line, and not since.


#13

Putting the #!/usr/local/bin/php -q in the crontab isn’t going to impact anything you run in cron. That’s just a suggestion from the wiki of what the first line of send_reminders.php should look like.

When you run it from command line, does it give any errors?
Maybe it’s really working from command line, but it knows better than to send reminders that it’s already sent.

From command line, if you type: ls -l /usr/local/bin/php
It should show /usr/local/php5/bin/php

It used to be that Webcalendar was PHP4 only. Since PHP4 doesn’t seem to be on the server anymore, I can’t recommend trying PHP4 to see if that’d get it to work.

As Webcalendar is a DreamHost provided One-Click, I suggest that you submit a ticket to Support and see if they have any ideas.


#14

No errors, but no reminders either.

It shows:
[haddock]$ ls -l /usr/local/bin/php
lrwxrwxrwx 1 root root 15 2010-06-07 10:07 /usr/local/bin/php -> …/php5/bin/php

Other users had problems with Webcalendar when PHP5 came out, but those were taken care of by upgrading to the newest version, which was PHP5 friendly. The Dreamhost one click is the latest, so that easy solution is out I’m afraid :frowning:

You could be right, I just didn’t want to bother them over something that might have been a boneheaded question to begin with.