Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted January 7, 20223 yr Under what user account do you recommend running the crontab tasks? Is there anything else I should be careful about? Maybe a short guide? I do know how to set crontab.
January 7, 20223 yr Community Expert We would not provide guides for how to set up server related tasks. You would generally run the task under the same account which is being used for your account on the server
January 7, 20223 yr Under what user account do you recommend running the crontab tasks? Is there anything else I should be careful about? Maybe a short guide? I do know how to set crontab. Are you setting up the cron in whm/cpanel or in SSH ?
January 7, 20223 yr Under what user account do you recommend running the crontab tasks? I don’t have a suggestion for what user account to use, but I would not use the root account. Also, make sure the user account you end up using has access to run PHP and to read the directory in which the files are stored. I’ve switched to running the tasks with traffic, but earlier I used an user account named after my community. This user ran nginx and PHP, and had access to the files.
January 7, 20223 yr Why did you switched back to running them with traffic? To be honest I don’t remember, but it was either because running them with traffic is the default option, or because I ran into some issues with cron. All I can tell you for sure is that running the tasks with traffic works fine for my (small to medium sized) community.
January 7, 20223 yr Author Ah, ok. I was thinking to switch from the "default" php to the "recommended" cron jobs.
January 7, 20223 yr Ah, ok. I was thinking to switch from the "default" php to the "recommended" cron jobs. You can always try! The worst thing that could happen is that some tasks stop running and you’ll see a huge warning in the ACP. You can easily switch back if cron doesn’t work for you.
January 7, 20223 yr Community Expert I'll move this to our advanced server assistance forum as this is a little outside our scope of the forum we're in now. If any one would like to continue discussion, certainly welcome to.
January 8, 20223 yr Community Expert In general, run cron scripts as whatever user you would generally access the site via FTP with. In most cases, that user will already have permission to the files associated with your website and already operate in a more limited basis than say a super user account. If you don't use user accounts, run it as the same user that Apache is running under. I believe the default account would then just be "apache".
January 8, 20223 yr Author I do not use FTP. And my apache2 is running under www-data:www-data user:group.
January 8, 20223 yr I do not use FTP. And my apache2 is running under www-data:www-data user:group. Then use the same user!
January 8, 20223 yr Community Expert I do not use FTP. And my apache2 is running under www-data:www-data user:group. OK. Then use that as your cron user. From root, run: crontab -u www-data -e It will launch a text editor. In the editor, you can add: */3 * * * * followed by the exact text IPS provides you in the admin CP for the path to the cron job. For me it was: */3 * * * * /usr/local/php74/bin/php -d memory_limit=-1 -d max_execution_time=0 /PATH/TO/MY/IPB/applications/core/interface/task/task.php MYMD5HASHKEY >/dev/null 2>&1 Save the changes and you should be set. It should give you a message that the new cron was installed. IPS by default recommends running the cron every minute. I found it choked things a bit when the server had higher loads, so I run it every 3 minutes. You can adjust the frequency as you want. Edited January 8, 20223 yr by Randy Calvert
January 10, 20223 yr We do recommend setting the job to run every minute, which should be: * * * * * /usr/local/php74/bin/php -d memory_limit=-1 -d max_execution_time=0 /PATH/TO/MY/IPB/applications/core/interface/task/task.php MYMD5HASHKEY >/dev/null 2>&1 rather than: */3 * * * * which would run every three minutes. Doing it every 3 minutes might not hurt, but could possibly cause issues with some timed events.