dutchsnowden Posted January 7, 2022 Posted January 7, 2022 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.
Marc Posted January 7, 2022 Posted January 7, 2022 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
IveLeft... Posted January 7, 2022 Posted January 7, 2022 8 hours ago, dutchsnowden said: 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 ?
Runar Posted January 7, 2022 Posted January 7, 2022 10 hours ago, dutchsnowden said: 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.
dutchsnowden Posted January 7, 2022 Author Posted January 7, 2022 Why did you switched back to running them with traffic?
Runar Posted January 7, 2022 Posted January 7, 2022 1 minute ago, dutchsnowden said: 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.
dutchsnowden Posted January 7, 2022 Author Posted January 7, 2022 Ah, ok. I was thinking to switch from the "default" php to the "recommended" cron jobs.
Runar Posted January 7, 2022 Posted January 7, 2022 5 minutes ago, dutchsnowden said: 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. dutchsnowden 1
Jim M Posted January 7, 2022 Posted January 7, 2022 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. dutchsnowden 1
dutchsnowden Posted January 7, 2022 Author Posted January 7, 2022 Thanks, sorry for starting it here. You are right.
Randy Calvert Posted January 8, 2022 Posted January 8, 2022 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".
dutchsnowden Posted January 8, 2022 Author Posted January 8, 2022 I do not use FTP. And my apache2 is running under www-data:www-data user:group.
Daniel F Posted January 8, 2022 Posted January 8, 2022 1 minute ago, dutchsnowden said: I do not use FTP. And my apache2 is running under www-data:www-data user:group. Then use the same user! dutchsnowden 1
Randy Calvert Posted January 8, 2022 Posted January 8, 2022 (edited) 4 minutes ago, dutchsnowden said: 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, 2022 by Randy Calvert
dutchsnowden Posted January 8, 2022 Author Posted January 8, 2022 thank you all so much! SeNioR- and Randy Calvert 2
Mark H Posted January 10, 2022 Posted January 10, 2022 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. dutchsnowden 1
Recommended Posts