Daemon only works in foreground

Daemon only works in foreground

by Emanuel Delgado -
Number of replies: 2
Hello,

I am trying to put chat running whith daemon but it only works when I run it in foreground.

Something like this:

1. php --chatd.php --start &
It starts the daemon but chat on Moodle does not work.

2. fg
Daemon runs in foreground and I can see the daemon's message saying it is running ok and chat in Moodle works!

Everytime I put the daemon in background, it stops working in Moodle.

I am using Moodle 1.9.5 downloaded today.

Can someone tell me how can I put the daemon working in background AND in Moodle at the same time?

Thanks in advance,
Emanuel Delgado
Average of ratings: -
In reply to Emanuel Delgado

Re: Daemon only works in foreground

by Carlos Freire -

I have the same problem. When I run this the chat works fine:

/usr/bin/php /var/www/moodle/mod/chat/chatd.php --start -v -l /var/log/chatd.log

but if I try to run in background it doesn't work:

/usr/bin/php /var/www/moodle/mod/chat/chatd.php --start -v -l /var/log/chatd.log &

I have Moodle 2.5.2 in CentOS.

In reply to Carlos Freire

Re: Daemon only works in foreground

by Carlos Freire -

I found the solution! This is my batch file:

#!/bin/bash
cd /var/www/moodle/mod/chat/ && /usr/bin/php chatd.php --start -l /var/log/chatd.log > /dev/null &

Average of ratings: Useful (1)