Garfield (Linux): Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
(14 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
Zeile 8: | Zeile 8: | ||
sudo chmod a+x /mnt/synology/web1/home/garfield/bin/*.sh | sudo chmod a+x /mnt/synology/web1/home/garfield/bin/*.sh | ||
sudo chown -R www-data:www-data /mnt/synology/web1/home/garfield/ | |||
</pre> | </pre> | ||
Zeile 19: | Zeile 20: | ||
#!/bin/sh | #!/bin/sh | ||
# | # | ||
# Starts download of Garfield strips for / | # Starts download of Garfield strips for /mnt/synology/web1/www/garfield | ||
# | # | ||
current_dir=`pwd` | current_dir=`pwd` | ||
base_dir_binary=/home | base_dir_binary=/mnt/synology/web1/home/garfield | ||
base_dir_homepage=/ | base_dir_homepage=/mnt/synology/web1/www/garfield | ||
echo "Move to '$base_dir_homepage'..." | echo "Move to '$base_dir_homepage'..." | ||
Zeile 44: | Zeile 45: | ||
#!/bin/sh | #!/bin/sh | ||
# | # | ||
# Starts download of Garfield strips for /home | # Starts download of Garfield strips for /mnt/synology/web1/home/garfield/downloads/ | ||
# | # | ||
current_dir=`pwd` | current_dir=`pwd` | ||
base_dir_binary=/home | base_dir_binary=/mnt/synology/web1/home/garfield | ||
base_dir_backup=/home | base_dir_backup=/mnt/synology/web1/home/garfield/downloads | ||
echo "Move to '$base_dir_backup'..." | echo "Move to '$base_dir_backup'..." | ||
Zeile 54: | Zeile 55: | ||
echo 'Downloading strips (Backup)...' | echo 'Downloading strips (Backup)...' | ||
sudo -u | sudo -u www-data java -jar $base_dir_binary/bin/garfield-1.0.jar . | ||
echo "Move back to original folder ('$current_dir')..." | echo "Move back to original folder ('$current_dir')..." | ||
Zeile 64: | Zeile 65: | ||
<pre> | <pre> | ||
sudo vi /mnt/synology/web1/home/garfield/bin/send.sh | sudo vi /mnt/synology/web1/home/garfield/bin/send.sh | ||
</pre | </pre> | ||
<pre> | <pre> | ||
#!/bin/sh | |||
# | |||
# Sending of Garfield strips per mail | |||
# | |||
year=`date +%Y` | |||
month=`date +%m` | |||
day=`date +%d` | |||
file_name=$year-$month-$day.gif | |||
folder=/mnt/synology/web1/home/garfield/downloads/$year/$month | |||
current_date=$day-$month-$year | |||
if [ -e $folder/$file_name ] ; then | |||
echo "Garfield strip from $current_date" | mutt -a $folder/$file_name -s "Garfield $current_date" -- martin@kirner.or.at 2>&1 | |||
echo "Garfield $current_date successfully sent..." | |||
fi | |||
</pre> | |||
== Webserver == | |||
Zertifikat siehe [[SSL_Zertifikat]] | |||
=== Root-Verzeichnis === | |||
<pre> | |||
sudo mkdir /mnt/synology/web1/www/garfield | |||
sudo chown -R www-data:www-data /mnt/synology/web1/www/garfield | |||
</pre> | |||
=== garfield.conf === | |||
<pre> | |||
sudo vi /etc/apache2/sites-available/garfield.conf | |||
</pre> | |||
<pre> | |||
<VirtualHost *:80> | |||
ServerName garfield.kirner.or.at | |||
Redirect / https://garfield.kirner.or.at/ | |||
</VirtualHost> | |||
</pre> | |||
=== garfield-ssl.conf === | |||
<pre> | |||
sudo vi /etc/apache2/sites-available/garfield-ssl.conf | |||
</pre> | |||
<pre> | |||
<VirtualHost *:443> | |||
ServerName garfield.kirner.or.at | |||
SSLEngine on | |||
SSLCertificateFile /etc/ssl/certs/garfield.crt | |||
SSLCertificateKeyFile /etc/ssl/private/apache.key | |||
# Pfad zu den Webinhalten | |||
DocumentRoot /mnt/synology/web1/www/garfield | |||
<Directory "/mnt/synology/web1/www/garfield"> | |||
AuthType Basic | |||
AuthName "Restricted Content" | |||
AuthUserFile /etc/apache2/.htpasswd | |||
Require valid-user | |||
</Directory> | |||
ErrorLog ${APACHE_LOG_DIR}/garfield.kirner.or.at-error.log | |||
CustomLog ${APACHE_LOG_DIR}/garfield.kirner.or.at-access.log combined | |||
</VirtualHost> | |||
</pre> | |||
=== Konfigurationen aktivieren === | |||
<pre> | |||
cd /etc/apache2/sites-available/ | |||
sudo a2ensite garfield.conf | |||
sudo a2ensite garfield-ssl.conf | |||
sudo systemctl reload apache2.service | |||
</pre> | |||
== Cron-Jobs == | |||
<pre> | |||
sudo crontab -e | |||
</pre> | |||
<pre> | |||
0 9 * * * /mnt/synology/web1/home/garfield/bin/download_homepage.sh > /mnt/synology/web1/home/garfield/bin/garfield.log 2>&1 | |||
15 9 * * * /mnt/synology/web1/home/garfield/bin/download_backup.sh >> /mnt/synology/web1/home/garfield/bin/garfield.log 2>&1 | |||
30 9 * * * /mnt/synology/web1/home/garfield/bin/send.sh >> /mnt/synology/web1/home/garfield/bin/garfield.log 2>&1 | |||
</pre> | |||
Zurück zu [[Ubuntu#G (Server)|Ubuntu]] | Zurück zu [[Ubuntu#G (Server)|Ubuntu]] |
Aktuelle Version vom 20. August 2020, 21:51 Uhr
Skripte
sudo mkdir -p /mnt/synology/web1/home/garfield/bin/ sudo touch /mnt/synology/web1/home/garfield/bin/download_homepage.sh sudo touch /mnt/synology/web1/home/garfield/bin/download_backup.sh sudo touch /mnt/synology/web1/home/garfield/bin/send.sh sudo chmod a+x /mnt/synology/web1/home/garfield/bin/*.sh sudo chown -R www-data:www-data /mnt/synology/web1/home/garfield/
download_homepage.sh
sudo vi /mnt/synology/web1/home/garfield/bin/download_homepage.sh
#!/bin/sh # # Starts download of Garfield strips for /mnt/synology/web1/www/garfield # current_dir=`pwd` base_dir_binary=/mnt/synology/web1/home/garfield base_dir_homepage=/mnt/synology/web1/www/garfield echo "Move to '$base_dir_homepage'..." cd $base_dir_homepage echo 'Downloading strips (Homepage)...' sudo -u www-data java -jar $base_dir_binary/bin/garfield-1.0.jar . echo "Move back to original folder ('$current_dir')..." cd $current_dir
download_backup.sh
sudo vi /mnt/synology/web1/home/garfield/bin/download_backup.sh
#!/bin/sh # # Starts download of Garfield strips for /mnt/synology/web1/home/garfield/downloads/ # current_dir=`pwd` base_dir_binary=/mnt/synology/web1/home/garfield base_dir_backup=/mnt/synology/web1/home/garfield/downloads echo "Move to '$base_dir_backup'..." cd $base_dir_backup echo 'Downloading strips (Backup)...' sudo -u www-data java -jar $base_dir_binary/bin/garfield-1.0.jar . echo "Move back to original folder ('$current_dir')..." cd $current_dir
send.sh
sudo vi /mnt/synology/web1/home/garfield/bin/send.sh
#!/bin/sh # # Sending of Garfield strips per mail # year=`date +%Y` month=`date +%m` day=`date +%d` file_name=$year-$month-$day.gif folder=/mnt/synology/web1/home/garfield/downloads/$year/$month current_date=$day-$month-$year if [ -e $folder/$file_name ] ; then echo "Garfield strip from $current_date" | mutt -a $folder/$file_name -s "Garfield $current_date" -- martin@kirner.or.at 2>&1 echo "Garfield $current_date successfully sent..." fi
Webserver
Zertifikat siehe SSL_Zertifikat
Root-Verzeichnis
sudo mkdir /mnt/synology/web1/www/garfield sudo chown -R www-data:www-data /mnt/synology/web1/www/garfield
garfield.conf
sudo vi /etc/apache2/sites-available/garfield.conf
<VirtualHost *:80> ServerName garfield.kirner.or.at Redirect / https://garfield.kirner.or.at/ </VirtualHost>
garfield-ssl.conf
sudo vi /etc/apache2/sites-available/garfield-ssl.conf
<VirtualHost *:443> ServerName garfield.kirner.or.at SSLEngine on SSLCertificateFile /etc/ssl/certs/garfield.crt SSLCertificateKeyFile /etc/ssl/private/apache.key # Pfad zu den Webinhalten DocumentRoot /mnt/synology/web1/www/garfield <Directory "/mnt/synology/web1/www/garfield"> AuthType Basic AuthName "Restricted Content" AuthUserFile /etc/apache2/.htpasswd Require valid-user </Directory> ErrorLog ${APACHE_LOG_DIR}/garfield.kirner.or.at-error.log CustomLog ${APACHE_LOG_DIR}/garfield.kirner.or.at-access.log combined </VirtualHost>
Konfigurationen aktivieren
cd /etc/apache2/sites-available/ sudo a2ensite garfield.conf sudo a2ensite garfield-ssl.conf sudo systemctl reload apache2.service
Cron-Jobs
sudo crontab -e
0 9 * * * /mnt/synology/web1/home/garfield/bin/download_homepage.sh > /mnt/synology/web1/home/garfield/bin/garfield.log 2>&1 15 9 * * * /mnt/synology/web1/home/garfield/bin/download_backup.sh >> /mnt/synology/web1/home/garfield/bin/garfield.log 2>&1 30 9 * * * /mnt/synology/web1/home/garfield/bin/send.sh >> /mnt/synology/web1/home/garfield/bin/garfield.log 2>&1
Zurück zu Ubuntu