1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/invidious_ynh.git synced 2024-09-03 19:15:55 +02:00

Add systemd timer

This commit is contained in:
ericgaspar 2021-06-22 10:06:39 +02:00
parent 9de0f82a67
commit 9574fa9902
No known key found for this signature in database
GPG key ID: 574F281483054D44
7 changed files with 23 additions and 3 deletions

10
conf/invidious.timer Normal file
View file

@ -0,0 +1,10 @@
# /etc/systemd/system/invidious.timer
[Unit]
Description=Lance Invidious toutes les heures
[Timer]
OnCalendar=hourly
[Install]
WantedBy=timers.target

View file

@ -4,11 +4,11 @@ After=syslog.target
After=network.target
[Service]
Type=simple
Type=oneshot
User=__APP__
Group=__APP__
WorkingDirectory=__FINALPATH__
ExecStart=__FINALPATH__/invidious -o invidious.log
ExecStart=__FINALPATH__/invidious -o invidious.log -p __PORT__
RestartSec=2s
Restart=always

View file

@ -60,6 +60,7 @@ ynh_backup --src_path="/etc/logrotate.d/$app"
#=================================================
ynh_backup --src_path="/etc/systemd/system/$app.service"
ynh_backup --src_path="/etc/systemd/system/invidious.timer"
#=================================================
# BACKUP VARIOUS FILES

View file

@ -145,6 +145,8 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=1
ynh_add_systemd_config
ynh_add_config --template="../conf/invidious.timer" --destination="/etc/systemd/system/invidious.timer"
#=================================================
# SETUP CRON
#=================================================

View file

@ -69,6 +69,12 @@ ynh_script_progression --message="Removing Invidious main directory..." --weight
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE SYSTEMD TIMER
#=================================================
ynh_secure_remove --file="/etc/systemd/system/invidious.timer"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================

View file

@ -100,6 +100,7 @@ ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
ynh_script_progression --message="Restoring the systemd configuration..." --weight=5
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
ynh_restore_file --origin_path="/etc/systemd/system/invidious.timer"
systemctl enable $app.service --quiet
#=================================================

View file

@ -82,7 +82,6 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=8
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
tempdir="$(mktemp -d)"
ynh_setup_source --dest_dir=$tempdir --source_id=crystal
ynh_exec_warn_less dpkg -i $tempdir/crystal_1.0.0-1_amd64.deb
@ -137,6 +136,7 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=2
# Create a dedicated systemd config
ynh_add_systemd_config
ynh_add_config --template="../conf/invidious.timer" --destination="/etc/systemd/system/invidious.timer"
#=================================================
# GENERIC FINALIZATION