Skip to content

Instantly share code, notes, and snippets.

@xerrni
Last active March 4, 2017 23:06
Show Gist options
  • Save xerrni/09633af5407272104a377b3cd073529c to your computer and use it in GitHub Desktop.
Save xerrni/09633af5407272104a377b3cd073529c to your computer and use it in GitHub Desktop.
fix graphs bug quickbox.io
#!/bin/bash
src1="/srv/rutorrent/home/widgets"
src2="/srv/rutorrent/home/inc"
cdir=$(pwd)
cd ${src1}
if [ $? -ne 0 ] # checking if command executed successfully
then
echo "Can\`t cd into ${src1}"
exit 1
fi
# repleacing recursively "INETFACE" string with "eth0" inside src1 directory
find . -type f -exec sed -i 's/INETFACE/eth0/g' {} +
if [ $? -ne 0 ]
then
echo "Can\`t replace -r string inside ${src1}"
exit 1
fi
cd ${src2}
if [ $? -ne 0 ]
then
echo "Can\`t cd into ${src1}"
exit 1
fi
# repleacing recursively "INETFACE" string with "eth0" inside src2 directory
find . -type f -exec sed -i 's/INETFACE/eth0/g' {} +
if [ $? -ne 0 ]
then
echo "Can\`t replace -r stirng inside ${src2}"
exit 1
fi
#going back to previous directory
cd ${cdir}
if [ $? -ne 0 ]
then
echo "Can\`t get back to current working dir."
exit 1
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment