mirror of
https://github.com/YunoHost-Apps/z-push_ynh.git
synced 2024-09-03 18:05:58 +02:00
Add logrotate capability
This commit is contained in:
parent
f04e3879ab
commit
90889ba3ac
6 changed files with 51 additions and 0 deletions
31
conf/logrotate
Normal file
31
conf/logrotate
Normal file
|
@ -0,0 +1,31 @@
|
|||
|
||||
LOGTOCHANGE/*.log {
|
||||
|
||||
# Rotate if the logfile exceeds 100Mo
|
||||
size 10M
|
||||
|
||||
# From https://stash.z-hub.io/projects/ZP/repos/z-push/browse/config/z-push.lr
|
||||
create www-data www-data
|
||||
|
||||
# Keep 12 old log maximum
|
||||
rotate 10
|
||||
|
||||
# Compress the logs with gzip
|
||||
compress
|
||||
|
||||
# Compress the log at the next cycle. So keep always 2 non compressed logs
|
||||
delaycompress
|
||||
|
||||
# Copy and truncate the log to allow to continue write on it. Instead of move the log.
|
||||
copytruncate
|
||||
|
||||
# Do not do an error if the log is missing
|
||||
missingok
|
||||
|
||||
# Not rotate if the log is empty
|
||||
notifempty
|
||||
|
||||
# Keep old logs in the same dir
|
||||
noolddir
|
||||
|
||||
}
|
|
@ -29,6 +29,7 @@ ynh_backup "$final_path" "sources"
|
|||
|
||||
# Backup logs
|
||||
ynh_backup "$final_logpath" "logs"
|
||||
ynh_backup "/etc/logrotate.d/$app" "logrotate"
|
||||
|
||||
# Copy NGINX configuration
|
||||
ynh_backup "$final_nginxconf" "nginx.conf"
|
||||
|
|
|
@ -108,6 +108,7 @@ sudo cp -R ../sources/$SFILE/* $final_path
|
|||
sed -i "s^define('TIMEZONE', .*^define('TIMEZONE', '$(cat /etc/timezone)');^" ../conf/config.php
|
||||
sed -i "s@ALIASTOCHANGE@$final_path@g" ../conf/config.php
|
||||
sed -i "s@LOGTOCHANGE@$final_logpath@g" ../conf/config.php
|
||||
sed -i "s@LOGTOCHANGE@$final_logpath@g" ../conf/logrotate
|
||||
|
||||
# Enable caldav carddav support
|
||||
if sudo yunohost app list --installed -f baikal | grep -q id ; then
|
||||
|
@ -151,6 +152,11 @@ sudo mkdir -p $final_logpath
|
|||
sudo chmod 750 $final_logpath
|
||||
sudo chown www-data:www-data $final_logpath
|
||||
|
||||
# Activate logrotate
|
||||
sudo cp ../conf/logrotate /etc/logrotate.d/$app
|
||||
sudo chmod 644 /etc/logrotate.d/$app
|
||||
sudo chown root:root /etc/logrotate.d/$app
|
||||
|
||||
#Copy XMLElement.php
|
||||
sudo ln -s /usr/share/awl/inc/XML* /var/www/$app/include/
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ sudo rm -rf /var/www/$app
|
|||
sudo rm -rf /var/log/$app
|
||||
sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
|
||||
sudo rm -f /etc/php5/fpm/pool.d/$app.conf
|
||||
sudo rm -f /etc/logrotate.d/$app
|
||||
|
||||
# Restart of services
|
||||
sudo service php5-fpm reload
|
||||
|
|
|
@ -23,6 +23,11 @@ sudo mkdir -p $final_logpath
|
|||
sudo cp -a ./logs/* $final_logpath/
|
||||
sudo chown -R www-data:www-data $final_logpath
|
||||
|
||||
# Restore logrotate
|
||||
sudo cp -a ./logrotate /etc/logrotate.d/$app
|
||||
sudo chmod 644 /etc/logrotate.d/$app
|
||||
sudo chown root:root /etc/logrotate.d/$app
|
||||
|
||||
# Restore NGINX configuration
|
||||
sudo cp -a ./nginx.conf $final_nginxconf
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ sudo rm -rf $final_path
|
|||
sudo rm -rf $final_logpath
|
||||
sudo rm -f $final_nginxconf
|
||||
sudo rm -f $final_phpconf
|
||||
sudo rm -f /etc/logrotate.d/$app
|
||||
|
||||
# Copy files to the right place
|
||||
sudo mkdir -p $final_path
|
||||
|
@ -69,6 +70,7 @@ sudo cp -R ../sources/$SFILE/* $final_path
|
|||
sed -i "s^define('TIMEZONE', .*^define('TIMEZONE', '$(cat /etc/timezone)');^" ../conf/config.php
|
||||
sed -i "s@ALIASTOCHANGE@$final_path@g" ../conf/config.php
|
||||
sed -i "s@LOGTOCHANGE@$final_logpath@g" ../conf/config.php
|
||||
sed -i "s@LOGTOCHANGE@$final_logpath@g" ../conf/logrotate
|
||||
|
||||
# Enable caldav carddav support
|
||||
if sudo yunohost app list --installed -f baikal | grep -q id ; then
|
||||
|
@ -112,6 +114,11 @@ sudo mkdir -p $final_logpath
|
|||
sudo chmod 750 $final_logpath
|
||||
sudo chown www-data:www-data $final_logpath
|
||||
|
||||
# Activate logrotate
|
||||
sudo cp ../conf/logrotate /etc/logrotate.d/$app
|
||||
sudo chmod 644 /etc/logrotate.d/$app
|
||||
sudo chown root:root /etc/logrotate.d/$app
|
||||
|
||||
#Copy XMLElement.php
|
||||
sudo ln -s /usr/share/awl/inc/XML* /var/www/z-push/include/
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue