mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-10 00:28:22 +00:00
fix: [reset_ail] fix directory name
This commit is contained in:
parent
09ecc4d93f
commit
574b64b33b
1 changed files with 111 additions and 37 deletions
148
reset_AIL.sh
148
reset_AIL.sh
|
@ -6,52 +6,126 @@ GREEN="\\033[1;32m"
|
|||
|
||||
[ -z "$AIL_HOME" ] && echo "Needs the env var AIL_HOME. Run the script from the virtual environment." && exit 1;
|
||||
|
||||
# Make sure the reseting is intentional
|
||||
num=$(( ( RANDOM % 100 ) + 1 ))
|
||||
function soft_reset {
|
||||
# Access dirs and delete
|
||||
cd $AIL_HOME
|
||||
|
||||
echo -e $RED"To reset the platform, enter the following number: "$DEFAULT $num
|
||||
read userInput
|
||||
# Kill all screens
|
||||
screen -ls | grep Detached | cut -d. -f1 | awk '{print $1}' | xargs kill
|
||||
|
||||
if [ $userInput -eq $num ]
|
||||
then
|
||||
echo "Reseting AIL..."
|
||||
else
|
||||
echo "Wrong number"
|
||||
exit 1;
|
||||
fi
|
||||
set -e
|
||||
|
||||
# Access dirs and delete
|
||||
cd $AIL_HOME
|
||||
|
||||
# Kill all screens
|
||||
screen -ls | grep Detached | cut -d. -f1 | awk '{print $1}' | xargs kill
|
||||
if [ -d indexdir/ ]; then
|
||||
pushd indexdir/
|
||||
rm -r *
|
||||
echo 'cleaned indexdir'
|
||||
popd
|
||||
fi
|
||||
|
||||
set -e
|
||||
if [ $userInput -eq $num ]
|
||||
then
|
||||
if [ -d DATA_ARDB/ ]; then
|
||||
pushd DATA_ARDB/
|
||||
rm -r *
|
||||
echo 'cleaned DATA_ARDB'
|
||||
popd
|
||||
fi
|
||||
fi
|
||||
|
||||
# Access dirs and delete
|
||||
cd $AIL_HOME
|
||||
if [ -d logs/ ]; then
|
||||
pushd logs/
|
||||
rm *
|
||||
echo 'cleaned logs'
|
||||
popd
|
||||
fi
|
||||
|
||||
pushd dumps/
|
||||
rm *
|
||||
echo 'cleaned dumps'
|
||||
popd
|
||||
if [ -d PASTES/ ]; then
|
||||
pushd PASTES/
|
||||
rm -r *
|
||||
echo 'cleaned PASTES'
|
||||
popd
|
||||
fi
|
||||
|
||||
pushd indexdir/
|
||||
rm -r *
|
||||
echo 'cleaned indexdir'
|
||||
popd
|
||||
if [ -d HASHS/ ]; then
|
||||
pushd HASHS/
|
||||
rm -r *
|
||||
echo 'cleaned HASHS'
|
||||
popd
|
||||
fi
|
||||
|
||||
pushd LEVEL_DB_DATA/
|
||||
rm -r *
|
||||
echo 'cleaned LEVEL_DB_DATA'
|
||||
popd
|
||||
if [ -d CRAWLED_SCREESHOT/ ]; then
|
||||
pushd CRAWLED_SCREESHOT/
|
||||
rm -r *
|
||||
echo 'cleaned CRAWLED_SCREESHOT'
|
||||
popd
|
||||
fi
|
||||
|
||||
pushd logs/
|
||||
rm *
|
||||
echo 'cleaned logs'
|
||||
popd
|
||||
if [ -d temp/ ]; then
|
||||
pushd temp/
|
||||
rm -r *
|
||||
echo 'cleaned temp'
|
||||
popd
|
||||
fi
|
||||
|
||||
pushd PASTES/
|
||||
rm -r *
|
||||
echo 'cleaned PASTES'
|
||||
popd
|
||||
if [ -d var/www/submitted/ ]; then
|
||||
pushd var/www/submitted
|
||||
rm -r *
|
||||
echo 'cleaned submitted'
|
||||
popd
|
||||
fi
|
||||
|
||||
echo -e $GREEN"* AIL has been reset *"$DEFAULT
|
||||
echo -e $GREEN"* AIL has been reset *"$DEFAULT
|
||||
|
||||
exit
|
||||
}
|
||||
|
||||
#If no params,
|
||||
[[ $@ ]] || {
|
||||
# Make sure the reseting is intentional
|
||||
num=$(( ( RANDOM % 100 ) + 1 ))
|
||||
|
||||
echo -e $RED"To reset the platform, enter the following number: "$DEFAULT $num
|
||||
read userInput
|
||||
|
||||
if [ $userInput -eq $num ]
|
||||
then
|
||||
echo "Reseting AIL..."
|
||||
else
|
||||
echo "Wrong number"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
num=$(( ( RANDOM % 100 ) + 1 ))
|
||||
echo -e $RED"If yes you want to delete the DB , enter the following number: "$DEFAULT $num
|
||||
read userInput
|
||||
|
||||
set -e
|
||||
|
||||
soft_reset;
|
||||
|
||||
if [ $userInput -eq $num ]
|
||||
then
|
||||
if [ -d DATA_ARDB/ ]; then
|
||||
pushd DATA_ARDB/
|
||||
rm -r *
|
||||
echo 'cleaned DATA_ARDB'
|
||||
popd
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -e $GREEN"* AIL has been reset *"$DEFAULT
|
||||
|
||||
exit
|
||||
}
|
||||
|
||||
while [ "$1" != "" ]; do
|
||||
case $1 in
|
||||
--softReset ) soft_reset;
|
||||
;;
|
||||
* ) exit 1
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue