cron.sh:
#!/bin/bash
curl http://localhost/related.php &
curl http://localhost/artist_rank.php &
curl http://localhost/sitemap.php &
curl http://localhost/cache_validator.php &
curl http://localhost/redis_cleanup.php &
curl http://localhost/db_maintenance.php &
wait
now setup a localhost only webserver in nginx.conf to serve the crons. make sure the directory is not publically accessible from your website.
# local only webserver for cronjobs
server {
listen 80;
server_name localhost;
root /usr/share/nginx/crons;
location ~ \.(php)$ {
try_files $uri = 404;
location ~ \..*/.*\.php$ {return 404;}
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_keep_conn on;
fastcgi_pass unix:/var/run/hhvm/hhvm.sock; # ive setup a unix socket for my hhvm installation.
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location / {
index index.php;
}
}
now open crontab and add the command to run cron.sh!
*/10 * * * * ./usr/share/nginx/cron.sh