I'm managing a server witch host several ruby on rails websites. I need a cron job for every website that does :
- send emails (notifications)
- create thumbnails
Unfortunatly, every time the cron is executed, it takes 100% of the CPU usage, so that slows down all the websites.
I tried to use nice command in my crontab -e:
cd /home/www/manager && nice -n 19 /usr/local/bin/rake websites_cron RAILS_ENV=production
but after a little while i get rack process and passenger process with the same nice level as rake so it doesnt help at all...
Here is htop output with low usage http://img688.imageshack.us/img688/3637/capturedu20120807143520.png
Here is htop when cron job are executed http://img507.imageshack.us/img507/1736/capturedu20120807144808.png
--- Edit ---
I had an error in my code that was rebuilding all websites process
nice command is working