24 lines
703 B
Bash
24 lines
703 B
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
# 1. Install SimplePie if vendor folder is missing
|
|
if [ ! -d "/var/www/html/vendor" ]; then
|
|
echo "Vendor folder not found. Installing SimplePie..."
|
|
composer require simplepie/simplepie
|
|
fi
|
|
|
|
# 2. Ensure Cache folder exists and is writable
|
|
if [ ! -d "/var/www/html/cache" ]; then
|
|
mkdir -p /var/www/html/cache
|
|
chmod -R 777 /var/www/html/cache
|
|
fi
|
|
|
|
# 3. Setup Cron Job (Runs every 15 minutes)
|
|
# We overwrite the file to ensure no duplicates
|
|
echo "*/15 * * * * /usr/local/bin/php /var/www/html/fetch.php >> /var/www/html/cron_output.log 2>&1" > /etc/cron.d/rss-cron
|
|
chmod 0644 /etc/cron.d/rss-cron
|
|
crontab /etc/cron.d/rss-cron
|
|
service cron start
|
|
|
|
# 4. Start Apache
|
|
exec "$@" |