chg: [update 1.5] add update bash

This commit is contained in:
Terrtia 2018-12-19 11:41:01 +01:00
parent 2560260ce4
commit 198ee97d90
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0
3 changed files with 47 additions and 23 deletions

View file

@ -16,7 +16,6 @@ export AIL_HOME="${DIR}"
cd ${AIL_HOME}
if [ -e "${DIR}/AILENV/bin/python" ]; then
echo "AIL-framework virtualenv seems to exist, good"
ENV_PY="${DIR}/AILENV/bin/python"
else
echo "Please make sure you have a AIL-framework environment, au revoir"
@ -348,11 +347,15 @@ function launch_feeder {
function killall {
if [[ $isredis || $isardb || $islogged || $isqueued || $isscripted || $isflasked || $isfeeded ]]; then
if [[ $isredis ]]; then
echo -e $GREEN"Gracefully closing redis servers"$DEFAULT
shutting_down_redis;
sleep 0.2
fi
if [[ $isardb ]]; then
echo -e $GREEN"Gracefully closing ardb servers"$DEFAULT
shutting_down_ardb;
fi
echo -e $GREEN"Killing all"$DEFAULT
kill $isredis $isardb $islogged $isqueued $isscripted $isflasked $isfeeded
sleep 0.2

View file

@ -91,19 +91,11 @@ if __name__ == '__main__':
for key in r_serv_metadata.scan_iter(key_to_rename):
temp = []
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)
index = index +1
temp.append((key, zset_key))
keys_to_add.append((key, new_key, value))
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)
else:
keys_to_remove.append(key)
@ -183,14 +175,6 @@ if __name__ == '__main__':
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()

View file

@ -1,4 +1,41 @@
#!/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