I have some web scraping and screeshotting using Symphony Panther. That worked flawlessly on my dev machine. With some adaptions I made it work on a Ubuntu 22 server also. Now I wanted to do it as a cron job.
I added
/usr/bin/php /usr/local/bin/composer --working-dir /opt/mybot/ start >> /var/log/mybot/cron.log 2>&1
As a cron job. While normale scraping worked fine, as soon as I want to create a firefox screenshot I get an exception
PHP Fatal error: Uncaught RuntimeException: Could not start firefox. Exit code: 1 (General error). Error output: /system.slice/cron.service is not a snap croup
However as long as I am logged into that machine via SSH (without doing anything else) the cron job runs fine without any exception. That puzzles me a bit (and makes it hard to debug to be fair).
Is there something I can do, so that it works unattended?