parent
fbe1766aea
commit
a7a5f88142
@ -1,6 +1,5 @@ |
||||
#!/bin/sh |
||||
ORIG_ONIONR_RUN_DIR=`pwd` |
||||
export ORIG_ONIONR_RUN_DIR |
||||
cd "$(dirname "$0")" |
||||
cd onionr/ |
||||
./__init__.py "$@" |
||||
|
@ -1,10 +1,12 @@ |
||||
import os, filepaths |
||||
def delete_run_files(): |
||||
|
||||
def _safe_remove(path): |
||||
try: |
||||
os.remove(filepaths.public_API_host_file) |
||||
os.remove(path) |
||||
except FileNotFoundError: |
||||
pass |
||||
try: |
||||
os.remove(filepaths.private_API_host_file) |
||||
except FileNotFoundError: |
||||
pass |
||||
|
||||
def delete_run_files(): |
||||
_safe_remove(filepaths.public_API_host_file) |
||||
_safe_remove(filepaths.private_API_host_file) |
||||
_safe_remove(filepaths.daemon_mark_file) |
||||
|
@ -0,0 +1,40 @@ |
||||
""" |
||||
Onionr - Private P2P Communication |
||||
|
||||
Command to restart Onionr |
||||
""" |
||||
""" |
||||
This program is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License |
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. |
||||
""" |
||||
import time |
||||
import os |
||||
import subprocess |
||||
import platform |
||||
|
||||
from etc import onionrvalues |
||||
from onionrutils import localcommand |
||||
import logger |
||||
|
||||
from . import daemonlaunch |
||||
|
||||
SCRIPT_NAME = os.path.dirname(os.path.realpath(__file__)) + f'/../../{onionrvalues.SCRIPT_NAME}' |
||||
|
||||
def restart(): |
||||
logger.info('Restarting Onionr', terminal=True) |
||||
daemonlaunch.kill_daemon() |
||||
while localcommand.local_command('ping', maxWait=8) == 'pong!': |
||||
time.sleep(0.3) |
||||
subprocess.Popen([SCRIPT_NAME, 'start']) |
||||
|
||||
restart.onionr_help = 'Gracefully restart Onionr' |
Loading…
Reference in new issue