1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/shellinabox_ynh.git synced 2024-09-03 20:26:12 +02:00
This commit is contained in:
Éric Gaspar 2023-06-04 21:55:04 +02:00
parent 39e05255a3
commit 925bb7cf88
6 changed files with 49 additions and 0 deletions

38
conf/shellinabox.service Normal file
View file

@ -0,0 +1,38 @@
# Make it bootable at startup
[Install]
WantedBy=multi-user.target
[Unit]
Documentation=man:shellinaboxd(1)
# Sourcing LSB Path
SourcePath=/etc/init.d/shellinabox
Description=LSB: Shell In A Box Daemon
Before=multi-user.target
Before=graphical.target
After=network-online.target
# Awaits LDAP is specific user binding at startup
After=slapd.service
After=remote-fs.target
Wants=network-online.target
Requires=slapd.service
[Service]
Type=forking
# Calls for restart when there is a fail
Restart=on-failure
RestartSec=5min
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=no
SuccessExitStatus=5 6
# Gracefully wait for every service to come up
ExecStartPre=/bin/sleep 3
ExecStart=/etc/init.d/shellinabox start
ExecStop=/etc/init.d/shellinabox stop
ExecReload=/etc/init.d/shellinabox reload

View file

@ -27,6 +27,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/shellinabox"
ynh_backup --src_path="/etc/default/shellinabox"
ynh_backup --src_path="/etc/systemd/system/shellinabox.service"
#=================================================
# END OF SCRIPT

View file

@ -33,6 +33,10 @@ ynh_script_progression --message="Configuring a systemd service..."
# Allow the service to log in syslog
ynh_replace_string --match_string=" -- -q --background" --replace_string=" -- --background" --target_file="/etc/init.d/shellinabox"
# Enable SystemD respawn feature and boot order to avoid premature crashs
cp ../conf/shellinabox.service /etc/systemd/system/shellinabox.service
systemctl daemon-reload
#=================================================

View file

@ -28,6 +28,9 @@ ynh_remove_nginx_config
# Remove metapackage and its dependencies
ynh_package_autopurge shellinabox
# Remove Systemd auto-created daemon
rm -f /etc/systemd/system/shellinabox.service
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -24,6 +24,7 @@ ynh_script_progression --message="Restoring various files..." --weight=3
ynh_restore_file --origin_path="/etc/shellinabox"
ynh_restore_file --origin_path="/etc/default/shellinabox"
ynh_restore_file --origin_path="/etc/systemd/system/shellinabox.service"
#=================================================
# RESTORE SYSTEMD

View file

@ -46,6 +46,8 @@ ynh_add_config --template="../conf/shellinabox" --destination="/etc/default/shel
#=================================================
ynh_script_progression --message="Upgrading systemd configuration..."
cp ../conf/shellinabox.service /etc/systemd/system/shellinabox.service
ynh_replace_string --match_string=" -- -q --background" --replace_string=" -- --background" --target_file="/etc/init.d/shellinabox"
systemctl daemon-reload