I'm a beginner in shell scripting. I would really appreciate some help from the forum.
I want to write a small script that will look in apache error log. If it finds the appropriate word. It would execute some commands.
In my case the apache error log is situated in: /usr/local/apache2/logs/error_log
The words that I would like to grep are : Berkeley DB error for filesystem
Only if it finds them then I need to execute the following commands:
---------- Post updated at 18:33 ---------- Previous update was at 18:28 ----------
Anyway, how about
if grep "Berkeley DB error for filesystem" /usr/local/apache2/logs/error_log
then /usr/local/apache2/bin/apachectl stop
svnadmin recover /export/data/svn/svnrepo/
cd /export/data/svn/svnrepo/db/
chown svn:svn *
/usr/local/apache2/bin/apachectl start
fi