-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into modify_market_token_p…
…rice
- Loading branch information
Showing
3 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/sh | ||
|
||
pid=`ps -ef | grep "update_pools.py [NETWORK_ID] 5000" | grep -v grep | /usr/bin/awk '{print $2}'` | ||
|
||
cd "[CUR_PATH]" | ||
|
||
# echo ${pid} | ||
date >> backend_update_pools.log | ||
|
||
if [ ! ${pid} ]; then | ||
# echo "is null" | ||
echo "No backend process rubbish to clean." >> backend_update_pools.log | ||
else | ||
# echo "not null" | ||
kill -s 9 ${pid} | ||
echo "Warning: clean backend process of last round." >> backend_update_pools.log | ||
fi | ||
. ../venv/bin/activate | ||
python update_pools.py [NETWORK_ID] 5000 >> backend_update_pools.log | ||
echo 'OK' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import sys | ||
sys.path.append('../') | ||
from config import Cfg | ||
|
||
if __name__ == '__main__': | ||
cur_path = sys.path[0] | ||
print("Working Path is:", cur_path) | ||
|
||
network_id = Cfg.NETWORK_ID | ||
|
||
exec_lines = [] | ||
tmpl = open("%s/backend_update_pools_5.sh.tmpl" % cur_path, mode='r') | ||
while True: | ||
line = tmpl.readline() | ||
if not line: | ||
break | ||
exec_lines.append(line.replace("[CUR_PATH]", cur_path).replace("[NETWORK_ID]", network_id)) | ||
tmpl.close() | ||
|
||
target_file = open("%s/backend_update_pools_5.sh" % cur_path, mode='w') | ||
target_file.writelines(exec_lines) | ||
target_file.close() | ||
|
||
print("Note: backend_update_pools_5.sh should be generated at that Path, ") | ||
print("please make it excuteable, such as chmod a+x backend_update_pools_5.sh. ") | ||
print("and then put it into crontab for periodically invoke!") | ||
print("Crontab eg: ") | ||
print(" */1 * * * * /working_path/backend_update_pools_5.sh > /dev/null") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters