0

I have a daily batch run in django with cron.

# crontab -e

All but the bottom of these batches seem to work correctly.

0 0 * * * root /root/certbot.sh
0 18 * * * root /var/www/html/venv/bin/python /var/www/html/portfolio/mysite/manage.py daily_import_from_vietkabu
5 18 * * * root /var/www/html/venv/bin/python /var/www/html/portfolio/mysite/manage.py daily_import_from_sbi
6 18 * * * root /var/www/html/venv/bin/python /var/www/html/portfolio/mysite/manage.py daily_import_from_bloomberg
15 18 * * * root /var/www/html/venv/bin/python /var/www/html/portfolio/mysite/manage.py daily_industry_chart_and_uptrends       
20 18 * * * root /var/www/html/venv/bin/python /var/www/html/portfolio/mysite/manage.py daily_industry_stacked_bar_chart        
30 18 * * * /root/collectstatic.sh           << this!!

The shell script that is triggered has the following written

(/root/collectstatic.sh)

# /bin/sh
cd /root
source /var/www/html/venv/bin/activate
python3 /var/www/html/portfolio/mysite/manage.py collectstatic --noinput

The command at the bottom is the standard django command to copy static files to a fixed location. These batches with cron, as far as I remember, came straight from the migration from "CentOS" and may not work well with current ubuntu with cron.

Has anyone ever run django's collectstatic with ubuntu's cron?

thanks.

yoshitaka okada
  • 113
  • 1
  • 12

0 Answers0