mirror of
https://github.com/YunoHost-Apps/phpservermon_ynh.git
synced 2024-09-03 19:56:40 +02:00
configure a CRON JOB
This commit is contained in:
parent
a3e1ab80b3
commit
dd36a23b29
7 changed files with 49 additions and 8 deletions
1
conf/phpservermon.cron
Normal file
1
conf/phpservermon.cron
Normal file
|
@ -0,0 +1 @@
|
|||
*/5 * * * * __USER__ /usr/bin/php__YNH_PHP_VERSION__ -f __DESTDIR__/cron/status.cron.php
|
|
@ -6,7 +6,7 @@
|
|||
"en": "$app is a script that checks whether your websites and servers are up and running",
|
||||
"fr": "$app est un application pour vérifier que vos sites web et serveurs fonctionnent"
|
||||
},
|
||||
"version": "3.5.2~ynh3",
|
||||
"version": "3.5.2~ynh4",
|
||||
"url": "www.phpservermonitor.org",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"maintainer": {
|
||||
|
|
|
@ -64,6 +64,12 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
|
||||
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE CRON FILE
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE MYSQL DATABASE
|
||||
#=================================================
|
||||
|
|
|
@ -162,6 +162,20 @@ ynh_replace_string --match_string="db_user" --replace_string=$db_user --target_f
|
|||
ynh_replace_string --match_string="db_pass" --replace_string=$db_pwd --target_file="$final_path/config.php"
|
||||
ynh_replace_string --match_string="db_name" --replace_string=$db_name --target_file="$final_path/config.php"
|
||||
ynh_replace_string --match_string="'PSM_BASE_URL', ''" --replace_string="'PSM_BASE_URL', '$path_url'" --target_file="$final_path/config.php"
|
||||
|
||||
#=================================================
|
||||
# ADD A CRON JOB
|
||||
#=================================================
|
||||
|
||||
cron_path="/etc/cron.d/$app"
|
||||
cp -a ../conf/phpservermon.cron "$cron_path"
|
||||
chown root: "$cron_path"
|
||||
chmod 644 "$cron_path"
|
||||
|
||||
ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="$cron_path"
|
||||
ynh_replace_string --match_string="__DESTDIR__" --replace_string="$final_path" --target_file="$cron_path"
|
||||
ynh_replace_string --match_string="__YNH_PHP_VERSION__" --replace_string="$phpversion" --target_file="$cron_path"
|
||||
|
||||
#=================================================
|
||||
# STORE THE CONFIG FILE CHECKSUM
|
||||
#=================================================
|
||||
|
|
|
@ -72,14 +72,13 @@ ynh_remove_fpm_config
|
|||
# REMOVE VARIOUS FILES
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE CRON FILE
|
||||
#=================================================
|
||||
|
||||
# Remove a cron file
|
||||
#ynh_secure_remove --file="/etc/cron.d/$app"
|
||||
|
||||
# Remove a directory securely
|
||||
#ynh_secure_remove --file="/etc/$app/"
|
||||
|
||||
# Remove the log files
|
||||
#ynh_secure_remove --file="/var/log/$app/"
|
||||
# TODO: Ensure that cron job is not running (How !?)
|
||||
ynh_secure_remove --file="/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
|
|
@ -91,6 +91,13 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=1
|
|||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE CRON FILE
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
||||
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
|
|
|
@ -118,6 +118,20 @@ ynh_store_file_checksum --file="$final_path/config.php"
|
|||
# Set permissions on app files
|
||||
chown -R $app:$app $final_path
|
||||
|
||||
#=================================================
|
||||
# UPDATE THE CRON JOB
|
||||
#=================================================
|
||||
|
||||
cron_path="/etc/cron.d/$app"
|
||||
cp -a ../conf/phpservermon.cron "$cron_path"
|
||||
chown root: "$cron_path"
|
||||
chmod 644 "$cron_path"
|
||||
|
||||
ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="$cron_path"
|
||||
ynh_replace_string --match_string="__DESTDIR__" --replace_string="$final_path" --target_file="$cron_path"
|
||||
ynh_replace_string --match_string="__YNH_PHP_VERSION__" --replace_string="$phpversion" --target_file="$cron_path"
|
||||
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue