mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-10 08:38:28 +00:00
chg: [update 1.5] add update bash
This commit is contained in:
parent
2560260ce4
commit
198ee97d90
3 changed files with 47 additions and 23 deletions
|
@ -16,7 +16,6 @@ export AIL_HOME="${DIR}"
|
||||||
cd ${AIL_HOME}
|
cd ${AIL_HOME}
|
||||||
|
|
||||||
if [ -e "${DIR}/AILENV/bin/python" ]; then
|
if [ -e "${DIR}/AILENV/bin/python" ]; then
|
||||||
echo "AIL-framework virtualenv seems to exist, good"
|
|
||||||
ENV_PY="${DIR}/AILENV/bin/python"
|
ENV_PY="${DIR}/AILENV/bin/python"
|
||||||
else
|
else
|
||||||
echo "Please make sure you have a AIL-framework environment, au revoir"
|
echo "Please make sure you have a AIL-framework environment, au revoir"
|
||||||
|
@ -348,11 +347,15 @@ function launch_feeder {
|
||||||
|
|
||||||
function killall {
|
function killall {
|
||||||
if [[ $isredis || $isardb || $islogged || $isqueued || $isscripted || $isflasked || $isfeeded ]]; then
|
if [[ $isredis || $isardb || $islogged || $isqueued || $isscripted || $isflasked || $isfeeded ]]; then
|
||||||
echo -e $GREEN"Gracefully closing redis servers"$DEFAULT
|
if [[ $isredis ]]; then
|
||||||
shutting_down_redis;
|
echo -e $GREEN"Gracefully closing redis servers"$DEFAULT
|
||||||
sleep 0.2
|
shutting_down_redis;
|
||||||
echo -e $GREEN"Gracefully closing ardb servers"$DEFAULT
|
sleep 0.2
|
||||||
shutting_down_ardb;
|
fi
|
||||||
|
if [[ $isardb ]]; then
|
||||||
|
echo -e $GREEN"Gracefully closing ardb servers"$DEFAULT
|
||||||
|
shutting_down_ardb;
|
||||||
|
fi
|
||||||
echo -e $GREEN"Killing all"$DEFAULT
|
echo -e $GREEN"Killing all"$DEFAULT
|
||||||
kill $isredis $isardb $islogged $isqueued $isscripted $isflasked $isfeeded
|
kill $isredis $isardb $islogged $isqueued $isscripted $isflasked $isfeeded
|
||||||
sleep 0.2
|
sleep 0.2
|
||||||
|
|
|
@ -91,19 +91,11 @@ if __name__ == '__main__':
|
||||||
for key in r_serv_metadata.scan_iter(key_to_rename):
|
for key in r_serv_metadata.scan_iter(key_to_rename):
|
||||||
temp = []
|
temp = []
|
||||||
for zset_key, value in r_serv_metadata.zscan_iter(key, '*{}*'.format(PASTES_FOLDER)):
|
for zset_key, value in r_serv_metadata.zscan_iter(key, '*{}*'.format(PASTES_FOLDER)):
|
||||||
#print(key)
|
|
||||||
#print(zset_key)
|
|
||||||
#print(value)
|
|
||||||
new_key = zset_key.replace(PASTES_FOLDER, '', 1)
|
new_key = zset_key.replace(PASTES_FOLDER, '', 1)
|
||||||
index = index +1
|
index = index +1
|
||||||
temp.append((key, zset_key))
|
temp.append((key, zset_key))
|
||||||
keys_to_add.append((key, new_key, value))
|
keys_to_add.append((key, new_key, value))
|
||||||
if 0 < len(temp) < r_serv_metadata.zcard(key):
|
if 0 < len(temp) < r_serv_metadata.zcard(key):
|
||||||
#print(key)
|
|
||||||
#print(len(temp))
|
|
||||||
#print(temp)
|
|
||||||
#print(r_serv_metadata.zcard(key))
|
|
||||||
#print('---------------')
|
|
||||||
zkeys_to_remove.extend(temp)
|
zkeys_to_remove.extend(temp)
|
||||||
else:
|
else:
|
||||||
keys_to_remove.append(key)
|
keys_to_remove.append(key)
|
||||||
|
@ -183,14 +175,6 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
end = time.time()
|
end = time.time()
|
||||||
|
|
||||||
''''
|
|
||||||
for key in r_serv_metadata.scan_iter('*{}*'.format(PASTES_FOLDER)):
|
|
||||||
if not 'dup:' in key:
|
|
||||||
if not 'paste_i2p_external_links:' in key:
|
|
||||||
if not 'base64:' in key:
|
|
||||||
print(key)
|
|
||||||
'''
|
|
||||||
|
|
||||||
print('Updating ARDB_Metadata Done => {} paths: {} s'.format(index, end - start))
|
print('Updating ARDB_Metadata Done => {} paths: {} s'.format(index, end - start))
|
||||||
|
|
||||||
print()
|
print()
|
||||||
|
|
|
@ -1,4 +1,41 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
echo $AIL_HOME
|
[ -z "$AIL_HOME" ] && echo "Needs the env var AIL_HOME. Run the script from the virtual environment." && exit 1;
|
||||||
|
[ -z "$AIL_REDIS" ] && echo "Needs the env var AIL_REDIS. Run the script from the virtual environment." && exit 1;
|
||||||
|
[ -z "$AIL_ARDB" ] && echo "Needs the env var AIL_ARDB. Run the script from the virtual environment." && exit 1;
|
||||||
|
[ -z "$AIL_BIN" ] && echo "Needs the env var AIL_ARDB. Run the script from the virtual environment." && exit 1;
|
||||||
|
[ -z "$AIL_FLASK" ] && echo "Needs the env var AIL_FLASK. Run the script from the virtual environment." && exit 1;
|
||||||
|
|
||||||
|
export PATH=$AIL_HOME:$PATH
|
||||||
|
export PATH=$AIL_REDIS:$PATH
|
||||||
|
export PATH=$AIL_ARDB:$PATH
|
||||||
|
export PATH=$AIL_BIN:$PATH
|
||||||
|
export PATH=$AIL_FLASK:$PATH
|
||||||
|
|
||||||
|
echo "Killing all screens ..."
|
||||||
|
bash -c "bash ${AIL_BIN}/LAUNCH.sh -k"
|
||||||
|
echo ""
|
||||||
|
echo "Starting ARDB ..."
|
||||||
|
bash -c "bash ${AIL_BIN}/launch_ardb.sh"
|
||||||
|
|
||||||
|
flag_ardb=true
|
||||||
|
while $flag_ardb; do
|
||||||
|
sleep 1
|
||||||
|
bash -c "bash ${AIL_BIN}/check_ardb.sh"
|
||||||
|
if [ $? == 0 ]; then
|
||||||
|
flag_ardb=false
|
||||||
|
else
|
||||||
|
echo "ARDB not available, waiting 5s before retry"
|
||||||
|
sleep 5
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
bash -c "python ${AIL_HOME}/update/v1.5/Update.py"
|
||||||
|
|
||||||
|
echo "Shutting down ARDB ..."
|
||||||
|
bash -c "bash ${AIL_BIN}/LAUNCH.sh -k"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
Loading…
Reference in a new issue