mirror of
https://github.com/YunoHost-Apps/calibreweb_ynh.git
synced 2024-09-03 18:16:20 +02:00
update systemd start and stop
This commit is contained in:
parent
f585b5e8a5
commit
0a5473fb1c
6 changed files with 40 additions and 15 deletions
17
.project
Normal file
17
.project
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>calibre_ynh</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.python.pydev.PyDevBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.python.pydev.pythonNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -25,6 +25,7 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
final_path=$(ynh_app_setting_get $app final_path)
|
||||
path_url=$(ynh_app_setting_get $app path)
|
||||
domain=$(ynh_app_setting_get $app domain)
|
||||
port=$(ynh_app_setting_get $app port)
|
||||
|
||||
#Get settings from database in case it has been changed in the app
|
||||
calibre_dir=$(sqlite3 $final_path/app.db "SELECT config_calibre_dir FROM settings WHERE ID=1")
|
||||
|
@ -90,8 +91,8 @@ ynh_backup --src_path="$calibre_dir" --is_big
|
|||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=5
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" -t 20
|
||||
sleep 2s
|
||||
ynh_systemd_action --service_name=$app --action="start" -l "server on :$port" -t 20
|
||||
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -119,8 +119,8 @@ fi
|
|||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=2
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" -t 20
|
||||
sleep 2s
|
||||
ynh_systemd_action --service_name=$app --action="start" -l "server on :$port" -t 20
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
|
|
|
@ -233,8 +233,7 @@ fi
|
|||
#=================================================
|
||||
ynh_script_progression --message="Reload nginx and start $app..." --weight=5
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
ynh_systemd_action --service_name=$app --action=start -t 20
|
||||
sleep 2s
|
||||
ynh_systemd_action --service_name=$app --action=start -l "server on :$port" -t 20
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -109,6 +109,11 @@ yunohost service add $app --description "Browse eBook in the web" --log "/var/lo
|
|||
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE LOG FILE DIRECTORY
|
||||
#=================================================
|
||||
mkdir -p /var/log/$app
|
||||
chown -R $app:$app /var/log/$app
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE DATA DIRECTORY
|
||||
|
@ -160,8 +165,7 @@ ynh_systemd_action --service_name=nginx --action=reload
|
|||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=2
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" -t 20
|
||||
sleep 2s
|
||||
ynh_systemd_action --service_name=$app --action="start" -l "server on :$port" -t 20
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -93,10 +93,10 @@ if version_gt "0.6.6" $current_upstream_app_version && [ $current_upstream_packa
|
|||
pip install --no-cache-dir --upgrade --target $final_path/vendor -r $final_path/requirements.txt
|
||||
chown -R $app: $final_path
|
||||
#set database settings as per conf file : restart server so that app.db is regenerated
|
||||
ynh_systemd_action
|
||||
ynh_systemd_action --service_name=$app --action="start" -line_match="server on " --log_path=$final_path/calibre-web.log -t 20
|
||||
#sleep required on low spec like raspberryPi
|
||||
sleep 5s
|
||||
ynh_systemd_action -a stop
|
||||
ynh_systemd_action --service_name=$app --action="stop"
|
||||
current_upstream_app_version="0.6.6"
|
||||
#remove unwanted entry in settings db
|
||||
fi
|
||||
|
@ -164,10 +164,14 @@ ynh_script_progression --message="Update database..." --weight=1
|
|||
ynh_backup_if_checksum_is_different "$final_path/app.db"
|
||||
|
||||
#set database settings as per conf file : restart server so that app.db is regenerated, then add new ldap & log settings
|
||||
ynh_systemd_action
|
||||
if [ $current_upstream_app_version == '0.6.6' ] ; then
|
||||
ynh_systemd_action --service_name=$app --action="start" -line_match="server on " --log_path=$final_path/calibre-web.log -t 20
|
||||
else
|
||||
ynh_systemd_action --service_name=$app --action="start" -line_match="server on :$port" -t 20
|
||||
fi
|
||||
#sleep required on low spec like raspberryPi
|
||||
sleep 5s
|
||||
ynh_systemd_action -a stop
|
||||
sleep 2s
|
||||
ynh_systemd_action --service_name=$app --action="stop"
|
||||
|
||||
conf="\"UPDATE settings SET $(. <(echo -E echo $(<../conf/init_calibre_db_settings))), $(. <(echo -E echo $(<../conf/init_calibre_db_ldap_settings))) WHERE ID=1\""
|
||||
eval sqlite3 $final_path/app.db "$conf"
|
||||
|
@ -232,8 +236,8 @@ ynh_systemd_action --service_name=nginx --action=reload
|
|||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=2
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" -t 20
|
||||
sleep 2s
|
||||
ynh_systemd_action --service_name=$app --action="start" -l "server on :$port" -t 20
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue