monicahq / monica

Personal CRM. Remember everything about your friends, family and business relationships.
https://beta.monicahq.com
GNU Affero General Public License v3.0
21.7k stars 2.18k forks source link

"Stay in Touch", cron, and database connection issues #4842

Open arfar opened 3 years ago

arfar commented 3 years ago

Describe the bug I have set up a few different "Stay in Touch" reminders which all should have triggered (I've been using Monica for about a month now and all my reminders are <1 month). Only one has been triggered however.

Which version are you using:

I'm not using docker or anything. If you need to know the version of anything else, please ask :)

Additional context I don't think there's an issue with the emailing, I can send myself test emails fine, and one of the reminders to stay in touch did come through just fine.

One of the logs showing what I think could be related to the issues: https://pastebin.com/7VE0K1NX I don't understand why I would be getting a database connection issue though, all the rest of the application works fine. Perhaps something to do with the php/cron/mysql environment not working? My cron job is also below. When I run the command in the shell, I don't get any errors.

I was able to check the crons table myself manually using the username and password from the .env file.

www-data@monica:~/monica$ mysql -u homestead -p monica -e 'SELECT * FROM crons;'
Enter password: 
+----+----------------------------+---------------------+---------------------+---------------------+
| id | command                    | last_run            | created_at          | updated_at          |
+----+----------------------------+---------------------+---------------------+---------------------+
|  1 | send:reminders             | 2021-02-04 17:00:02 | 2021-01-20 14:14:01 | 2021-02-04 17:00:02 |
|  2 | send:stay_in_touch         | 2021-02-04 17:00:02 | 2021-01-20 14:14:01 | 2021-02-04 17:00:02 |
|  3 | monica:calculatestatistics | 2021-02-04 00:00:03 | 2021-01-20 14:14:01 | 2021-02-04 00:00:03 |
|  4 | monica:ping                | 2021-02-04 00:00:03 | 2021-01-20 14:14:02 | 2021-02-04 00:00:03 |
|  5 | monica:clean               | 2021-02-04 00:00:04 | 2021-01-20 14:14:03 | 2021-02-04 00:00:04 |
|  6 | monica:updategravatars     | 2021-02-04 00:00:05 | 2021-01-20 14:14:03 | 2021-02-04 00:00:05 |
+----+----------------------------+---------------------+---------------------+---------------------+
www-data@monica:~/monica$ crontab -l
.
.
.
* * * * * /usr/bin/php /var/www/monica/artisan schedule:run >> /var/www/monica/storage/logs/cron 2>&1

I note I've only just added the /var/www/monica/storage/logs/cron part, the logs I've got thus far look like below (with lots more of the "fatal" errors)

fatal: not a git repository (or any of the parent directories): .git
No scheduled commands are ready to run.
fatal: not a git repository (or any of the parent directories): .git
Running scheduled command: '/usr/bin/php7.3' 'artisan' send:reminders > '/dev/null' 2>&1
Running scheduled command: '/usr/bin/php7.3' 'artisan' send:stay_in_touch > '/dev/null' 2>&1
fatal: not a git repository (or any of the parent directories): .git
No scheduled commands are ready to run.

Any help would be greatly appreciated. I'm moderately comfortable with Linux and programming, so if you wanted me to run any commands or try some thing, I'll try my best. I'm keep to get this sorted. Happy to chuck £10 Monica's way if I can sort this out :) (although I can't see any way to donate. Perhaps I'll just sign up for a month or something)

michaelmagan commented 3 years ago

I've got a very similar issue.