mirror of
https://github.com/YunoHost-Apps/ttrss_ynh.git
synced 2024-10-01 13:34:46 +02:00
[ehn] switch from cron job to systemd service for periodic feed update
This commit is contained in:
parent
481513180a
commit
5cadad6210
4 changed files with 35 additions and 13 deletions
11
conf/systemd.service
Normal file
11
conf/systemd.service
Normal file
|
@ -0,0 +1,11 @@
|
|||
[Unit]
|
||||
Description=ttrss_backend
|
||||
After=network.target mysql.service
|
||||
|
||||
[Service]
|
||||
User=__APP__
|
||||
Group=__APP__
|
||||
ExecStart=/usr/bin/php __FINALPATH__/update_daemon2.php
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -109,11 +109,10 @@ ynh_replace_string "__DOMAINPATH__" "https://$domain$path_url" "$final_path/conf
|
|||
ynh_store_file_checksum "$final_path/config.php"
|
||||
|
||||
#=================================================
|
||||
# ADD A CRON FILE
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
|
||||
echo "*/30 * * * * $app cd $final_path && /usr/bin/php $final_path/update.php --feeds >/dev/null 2>&1" \
|
||||
> /etc/cron.d/$app
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
|
@ -132,6 +131,12 @@ ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" \
|
|||
|
||||
sudo -u $app php ${final_path}/update.php --update-schema
|
||||
|
||||
#=================================================
|
||||
# START TTRSS IN BACKGROUND
|
||||
#=================================================
|
||||
|
||||
sudo systemctl start $app
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
|
|
@ -59,11 +59,10 @@ ynh_remove_fpm_config
|
|||
#=================================================
|
||||
# SPECIFIC REMOVE
|
||||
#=================================================
|
||||
# REMOVE THE CRON FILE
|
||||
# STOP AND REMOVE SERVICE
|
||||
#=================================================
|
||||
|
||||
# Remove a cron file
|
||||
ynh_secure_remove "/etc/cron.d/$app"
|
||||
ynh_remove_systemd_config
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
|
|
@ -101,13 +101,6 @@ ynh_replace_string "__DOMAINPATH__" "https://$domain$path_url" "$final_path/conf
|
|||
# Recalculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum "$final_path/config.php"
|
||||
|
||||
#=================================================
|
||||
# UPGRADE THE CRON FILE
|
||||
#=================================================
|
||||
|
||||
echo "*/30 * * * * $app cd $final_path && /usr/bin/php $final_path/update.php --feeds >/dev/null 2>&1" \
|
||||
> /etc/cron.d/$app
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DATABASE
|
||||
#=================================================
|
||||
|
@ -123,6 +116,20 @@ sudo -u $app php ${final_path}/update.php --update-schema
|
|||
chown -R root: $final_path
|
||||
chown -R $app $final_path/{cache,feed-icons,lock}
|
||||
|
||||
#=================================================
|
||||
# REMOVE OLD CRON JOB
|
||||
#=================================================
|
||||
|
||||
ynh_secure_remove "/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# UPGRADE SERVICE
|
||||
#=================================================
|
||||
|
||||
ynh_add_systemd_config
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl restart $app
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue