Jump to content

crontab tasks


Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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".  

Link to comment
Share on other sites

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 by Randy Calvert
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...