Create log files at install and restore steps

This commit is contained in:
Félix Piédallu 2023-11-05 23:07:21 +01:00
parent 98b9486f88
commit 0f9c946e92
2 changed files with 15 additions and 3 deletions

View File

@ -26,7 +26,7 @@ source /usr/share/yunohost/helpers
# ...
#
# $app is the app id (i.e. 'example' for first install,
# $app is the app id (i.e. 'example' for first install,
# or 'example__2', '__3', ... for multi-instance installs)
#
@ -44,7 +44,7 @@ ynh_script_progression --message="Setting up source files..." --weight=1
# Download, check integrity, uncompress and patch the source from manifest.toml
ynh_setup_source --dest_dir="$install_dir"
# $install_dir will automatically be initialized with some decent
# $install_dir will automatically be initialized with some decent
# permission by default ... however, you may need to recursively reapply
# ownership to all files such as after the ynh_setup_source step
chown -R $app:www-data "$install_dir"
@ -96,6 +96,12 @@ ynh_add_systemd_config
yunohost service add $app --description="A short description of the app" --log="/var/log/$app/$app.log"
# Create the log file (required for fail2ban)
mkdir -p "/var/log/$app"
touch "/var/log/$app/$app.log"
chown -R "$app:$app" "/var/log/$app"
chmod -R u=rwX,g=rX,o= "/var/log/$app"
### Additional options starting with 3.8:
###
### --needs_exposed_ports "$port" a list of ports that needs to be publicly exposed

View File

@ -17,7 +17,7 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
ynh_restore_file --origin_path="$install_dir"
# $install_dir will automatically be initialized with some decent
# $install_dir will automatically be initialized with some decent
# permissions by default ... however, you may need to recursively reapply
# ownership to all files such as after the ynh_setup_source step
chown -R $app:www-data "$install_dir"
@ -57,6 +57,12 @@ systemctl enable $app.service --quiet
yunohost service add $app --description="A short description of the app" --log="/var/log/$app/$app.log"
# Create the log file (required for fail2ban)
mkdir -p "/var/log/$app"
touch "/var/log/$app/$app.log"
chown -R "$app:$app" "/var/log/$app"
chmod -R u=rwX,g=rX,o= "/var/log/$app"
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf"