mirror of
https://github.com/YunoHost-Apps/pixelfed_ynh.git
synced 2024-09-03 20:06:04 +02:00
Add CRON
This commit is contained in:
parent
496f080193
commit
b1a0c2a5cd
6 changed files with 41 additions and 2 deletions
1
conf/cron
Normal file
1
conf/cron
Normal file
|
@ -0,0 +1 @@
|
|||
* * * * * cd __FINALPATH__/ && php7.3 artisan schedule:run >> /dev/null 2>&1
|
|
@ -86,6 +86,13 @@ ynh_print_info --message="Backing up supervisor configuration..."
|
|||
|
||||
ynh_backup --src_path="/etc/supervisor/conf.d/${app}-horizon.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP A CRON FILE
|
||||
#=================================================
|
||||
ynh_print_info --message="Backing up a cron file..."
|
||||
|
||||
ynh_backup --src_path="/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# START SUPERVISOR SERVICE
|
||||
#=================================================
|
||||
|
|
|
@ -198,6 +198,14 @@ pushd "$final_path"
|
|||
php7.3 artisan horizon:assets
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# INSTALL THE CRON FILE
|
||||
#=================================================
|
||||
ynh_print_info --message="Installing cron file..."
|
||||
|
||||
cp ../conf/cron "/etc/cron.d/$app"
|
||||
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
@ -222,7 +230,7 @@ ynh_use_logrotate --logfile="/var/log/$app/${app}-horizon.log"
|
|||
#=================================================
|
||||
ynh_print_info --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add "${app}-horizon" --description "${app}-horizon daemon for $app" --log "/var/log/$app/${app}-horizon.log"
|
||||
yunohost service add "supervisor" --description "${app}-horizon daemon for $app" --log "/var/log/$app/${app}-horizon.log"
|
||||
|
||||
#=================================================
|
||||
# START SUPERVISOR SERVICE
|
||||
|
|
|
@ -99,6 +99,14 @@ ynh_remove_logrotate
|
|||
|
||||
#=================================================
|
||||
# SPECIFIC REMOVE
|
||||
#=================================================
|
||||
# REMOVE THE CRON FILE
|
||||
#=================================================
|
||||
ynh_print_info --message="Removing the cron file..."
|
||||
|
||||
# Remove a cron file
|
||||
ynh_secure_remove --file="/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE LOG FILE
|
||||
#=================================================
|
||||
|
|
|
@ -139,7 +139,7 @@ supervisorctl reread && supervisorctl update
|
|||
#=================================================
|
||||
ynh_print_info --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add "${app}-horizon" --log "/var/log/$app/${app}-horizon.log"
|
||||
yunohost service add "supervisor" --log "/var/log/$app/${app}-horizon.log"
|
||||
|
||||
#=================================================
|
||||
# START SUPERVISOR SERVICE
|
||||
|
@ -148,6 +148,13 @@ ynh_print_info --message="Starting a supervisor service..."
|
|||
|
||||
ynh_supervisor_action --service_name="${app}-horizon" --action="start" --log_path="/var/log/$app/${app}-horizon.log"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE CRON FILE
|
||||
#=================================================
|
||||
ynh_print_info --message="Restoring the cron file..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
|
|
|
@ -226,6 +226,14 @@ mkdir -p "/var/log/$app/"
|
|||
touch "/var/log/$app/${app}-horizon.log"
|
||||
chown -R root: "/var/log/$app/"
|
||||
|
||||
#=================================================
|
||||
# UPGRADE THE CRON FILE
|
||||
#=================================================
|
||||
ynh_print_info --message="Upgrading cron file..."
|
||||
|
||||
cp ../conf/cron "/etc/cron.d/$app"
|
||||
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue