mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-03 21:29:59 -05:00
Installing Kiwix packages and service in Raspberry Pi and Debian installer scripts.
This commit is contained in:
parent
0eb321de9f
commit
1fff928d4e
11 changed files with 134 additions and 8 deletions
|
|
@ -108,6 +108,11 @@ class KiwixZimDownloader(Downloader):
|
|||
else:
|
||||
background_task(refresh_files([output_path, ]))
|
||||
|
||||
# Restart Kiwix serve, so it finds the new zim file.
|
||||
return_code = await lib.restart_kiwix()
|
||||
if return_code != 0:
|
||||
logger.error(f'Failed to restart kiwix')
|
||||
|
||||
# Location is just the generic Kiwix viewer.
|
||||
return DownloadResult(success=True, location='/zim')
|
||||
|
||||
|
|
|
|||
|
|
@ -482,3 +482,19 @@ def flag_kiwix_restart():
|
|||
flags.kiwix_restart.set()
|
||||
else:
|
||||
logger.debug(f'Not setting kiwix_restart flag because this is not Dockerized')
|
||||
|
||||
|
||||
async def restart_kiwix():
|
||||
if DOCKERIZED:
|
||||
logger.warning('Unable to restart Kiwix serve because it is in a docker container')
|
||||
return
|
||||
|
||||
logger.info('Restarting Kiwix serve')
|
||||
|
||||
cmd = f'sudo /usr/bin/systemctl restart wrolpi-kiwix.service'
|
||||
proc = await asyncio.create_subprocess_shell(cmd)
|
||||
stdout, stderr = await proc.communicate()
|
||||
logger.debug(f'systemctl returned {proc.returncode}')
|
||||
if proc.returncode != 0 and stderr:
|
||||
logger.debug(stderr)
|
||||
return proc.returncode
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue