mirror of
https://github.com/ggogel/seafile-containerized.git
synced 2024-11-16 17:05:32 +00:00
Make the start.py script run forever in foreground.
This commit is contained in:
parent
29bfc5385e
commit
2dc6f8d5bc
4
launcher
4
launcher
|
@ -65,7 +65,9 @@ bootstrap() {
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
set_volumes
|
set_volumes
|
||||||
docker run --rm -it --name seafile $volumes $image /scripts/start.py
|
docker run --rm -it --name seafile $volumes $image \
|
||||||
|
/sbin/my_init -- /scripts/start.py
|
||||||
|
# /sbin/my_init -- bash -l
|
||||||
}
|
}
|
||||||
|
|
||||||
enter() {
|
enter() {
|
||||||
|
|
|
@ -12,12 +12,24 @@ import os
|
||||||
from os.path import abspath, basename, exists, dirname, join, isdir
|
from os.path import abspath, basename, exists, dirname, join, isdir
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
|
import time
|
||||||
|
|
||||||
from utils import call, get_conf, get_install_dir, get_script
|
from utils import call, get_conf, get_install_dir, get_script, get_command_output
|
||||||
|
|
||||||
installdir = get_install_dir()
|
installdir = get_install_dir()
|
||||||
topdir = dirname(installdir)
|
topdir = dirname(installdir)
|
||||||
|
|
||||||
|
def watch_controller():
|
||||||
|
maxretry = 4
|
||||||
|
retry = 0
|
||||||
|
while retry < maxretry:
|
||||||
|
controller_pid = get_command_output('ps aux | grep seafile-controller |grep -v grep || true').strip()
|
||||||
|
if not controller_pid:
|
||||||
|
retry += 1
|
||||||
|
time.sleep(2)
|
||||||
|
print 'seafile controller exited unexpectedly.'
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
admin_pw = {
|
admin_pw = {
|
||||||
'email': get_conf('admin.email'),
|
'email': get_conf('admin.email'),
|
||||||
|
@ -34,5 +46,7 @@ def main():
|
||||||
if exists(password_file):
|
if exists(password_file):
|
||||||
os.unlink(password_file)
|
os.unlink(password_file)
|
||||||
|
|
||||||
|
watch_controller()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in a new issue