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:
parent
9de0f82a67
commit
9574fa9902
7 changed files with 23 additions and 3 deletions
10
conf/invidious.timer
Normal file
10
conf/invidious.timer
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
# /etc/systemd/system/invidious.timer
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description=Lance Invidious toutes les heures
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnCalendar=hourly
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
|
@ -4,11 +4,11 @@ After=syslog.target
|
||||||
After=network.target
|
After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=oneshot
|
||||||
User=__APP__
|
User=__APP__
|
||||||
Group=__APP__
|
Group=__APP__
|
||||||
WorkingDirectory=__FINALPATH__
|
WorkingDirectory=__FINALPATH__
|
||||||
ExecStart=__FINALPATH__/invidious -o invidious.log
|
ExecStart=__FINALPATH__/invidious -o invidious.log -p __PORT__
|
||||||
RestartSec=2s
|
RestartSec=2s
|
||||||
Restart=always
|
Restart=always
|
||||||
|
|
||||||
|
|
|
@ -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/$app.service"
|
||||||
|
ynh_backup --src_path="/etc/systemd/system/invidious.timer"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP VARIOUS FILES
|
# BACKUP VARIOUS FILES
|
||||||
|
|
|
@ -145,6 +145,8 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
|
|
||||||
|
ynh_add_config --template="../conf/invidious.timer" --destination="/etc/systemd/system/invidious.timer"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP CRON
|
# SETUP CRON
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -69,6 +69,12 @@ ynh_script_progression --message="Removing Invidious main directory..." --weight
|
||||||
# Remove the app directory securely
|
# Remove the app directory securely
|
||||||
ynh_secure_remove --file="$final_path"
|
ynh_secure_remove --file="$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE SYSTEMD TIMER
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_secure_remove --file="/etc/systemd/system/invidious.timer"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NGINX CONFIGURATION
|
# REMOVE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -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_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/$app.service"
|
||||||
|
ynh_restore_file --origin_path="/etc/systemd/system/invidious.timer"
|
||||||
systemctl enable $app.service --quiet
|
systemctl enable $app.service --quiet
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -82,7 +82,6 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=8
|
||||||
|
|
||||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
|
|
||||||
tempdir="$(mktemp -d)"
|
tempdir="$(mktemp -d)"
|
||||||
ynh_setup_source --dest_dir=$tempdir --source_id=crystal
|
ynh_setup_source --dest_dir=$tempdir --source_id=crystal
|
||||||
ynh_exec_warn_less dpkg -i $tempdir/crystal_1.0.0-1_amd64.deb
|
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
|
# Create a dedicated systemd config
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
|
ynh_add_config --template="../conf/invidious.timer" --destination="/etc/systemd/system/invidious.timer"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
|
Loading…
Add table
Reference in a new issue