helpers2.1: ynh_systemd_action -> ynh_systemctl

This commit is contained in:
Alexandre Aubin 2024-06-20 13:47:05 +02:00
parent d9b9aa1884
commit f22c6ec3e9
5 changed files with 10 additions and 10 deletions

View file

@ -105,7 +105,7 @@ ignoreregex =
chown -R "$app:$app" "/var/log/$app"
chmod -R u=rwX,g=rX,o= "/var/log/$app"
ynh_systemd_action --service=fail2ban --action=reload --wait_until="(Started|Reloaded) Fail2Ban Service" --log_path=systemd
ynh_systemctl --service=fail2ban --action=reload --wait_until="(Started|Reloaded) Fail2Ban Service" --log_path=systemd
local fail2ban_error="$(journalctl --no-hostname --unit=fail2ban | tail --lines=50 | grep "WARNING.*$app.*")"
if [[ -n "$fail2ban_error" ]]; then
@ -122,5 +122,5 @@ ignoreregex =
ynh_config_remove_fail2ban() {
ynh_safe_rm "/etc/fail2ban/jail.d/$app.conf"
ynh_safe_rm "/etc/fail2ban/filter.d/$app.conf"
ynh_systemd_action --service=fail2ban --action=reload
ynh_systemctl --service=fail2ban --action=reload
}

View file

@ -241,7 +241,7 @@ ynh_install_mongo() {
# Make sure MongoDB is started and enabled
systemctl enable $mongodb_servicename --quiet
systemctl daemon-reload --quiet
ynh_systemd_action --service=$mongodb_servicename --action=restart --wait_until="aiting for connections" --log_path="/var/log/mongodb/$mongodb_servicename.log"
ynh_systemctl --service=$mongodb_servicename --action=restart --wait_until="aiting for connections" --log_path="/var/log/mongodb/$mongodb_servicename.log"
# Integrate MongoDB service in YunoHost
yunohost service add $mongodb_servicename --description="MongoDB daemon" --log="/var/log/mongodb/$mongodb_servicename.log"

View file

@ -30,7 +30,7 @@ ynh_config_add_nginx() {
ynh_store_file_checksum "$finalnginxconf"
ynh_systemd_action --service=nginx --action=reload
ynh_systemctl --service=nginx --action=reload
}
# Remove the dedicated nginx config
@ -40,7 +40,7 @@ ynh_config_add_nginx() {
# Requires YunoHost version 2.7.2 or higher.
ynh_config_remove_nginx() {
ynh_safe_rm "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_systemd_action --service=nginx --action=reload
ynh_systemctl --service=nginx --action=reload
}

View file

@ -141,7 +141,7 @@ pm.process_idle_timeout = 10s
ynh_safe_rm "$fpm_config_dir/pool.d/$app.conf"
ynh_die "The new configuration broke php-fpm?"
fi
ynh_systemd_action --service=$fpm_service --action=reload
ynh_systemctl --service=$fpm_service --action=reload
}
# Remove the dedicated PHP-FPM config
@ -153,7 +153,7 @@ ynh_config_remove_phpfpm() {
local fpm_config_dir=$(ynh_app_setting_get --key=fpm_config_dir)
ynh_safe_rm "$fpm_config_dir/pool.d/$app.conf"
ynh_systemd_action --service="php${php_version}-fpm" --action=reload
ynh_systemctl --service="php${php_version}-fpm" --action=reload
}
# Define the values to configure PHP-FPM

View file

@ -35,7 +35,7 @@ ynh_config_add_systemd() {
ynh_config_remove_systemd() {
local service="${1:-$app}"
if [ -e "/etc/systemd/system/$service.service" ]; then
ynh_systemd_action --service=$service --action=stop
ynh_systemctl --service=$service --action=stop
systemctl disable $service --quiet
ynh_safe_rm "/etc/systemd/system/$service.service"
systemctl daemon-reload
@ -44,7 +44,7 @@ ynh_config_remove_systemd() {
# Start (or other actions) a service, print a log in case of failure and optionnaly wait until the service is completely started
#
# usage: ynh_systemd_action [--service=service] [--action=action] [ [--wait_until="line to match"] [--log_path=log_path] [--timeout=300] [--length=20] ]
# usage: ynh_systemctl [--service=service] [--action=action] [ [--wait_until="line to match"] [--log_path=log_path] [--timeout=300] [--length=20] ]
# | arg: -n, --service= - Name of the service to start. Default : `$app`
# | arg: -a, --action= - Action to perform with systemctl. Default: start
# | arg: -w, --wait_until= - The pattern to find in the log to attest the service is effectively fully started.
@ -53,7 +53,7 @@ ynh_config_remove_systemd() {
# | arg: -e, --length= - Length of the error log displayed for debugging : Default : 20
#
# Requires YunoHost version 3.5.0 or higher.
ynh_systemd_action() {
ynh_systemctl() {
# ============ Argument parsing =============
local -A args_array=([n]=service= [a]=action= [w]=wait_until= [p]=log_path= [t]=timeout= [e]=length=)
local service