Skip to content
Snippets Groups Projects
Commit 567b9056 authored by Pavel Vyskočil's avatar Pavel Vyskočil Committed by Pavel Vyskočil
Browse files

Added php_syntax_check.sh

parent fa46b51f
No related branches found
No related tags found
No related merge requests found
...@@ -3,13 +3,20 @@ ...@@ -3,13 +3,20 @@
## List of Local scripts ## List of Local scripts
Local scripts are located in /usr/lib/check_mk/local/ Local scripts are located in /usr/lib/check_mk/local/
### git_pull_check.sh ### php_syntax_check.sh
* Attributes to be filled: * Attributes to be filled:
<pre> <pre>
# List of paths to check separated by space # List of paths to check separated by space
paths="" paths=""
</pre> </pre>
### git_pull_check.sh
* Attributes to be filled:
<pre>
# The root directory to check
dir=""
</pre>
### services_running_check.sh ### services_running_check.sh
* Attributes to be filled: * Attributes to be filled:
<pre> <pre>
......
#!/bin/bash
#The root directory to check
dir="/etc/simplesamlphp"
cd $dir
paths=$(find . -type f -name "*.php")
globalResult=""
for path in $paths
do
if [[ -f $path ]] ; then
result=$(php -l $path 2>&1)
if [[ ! $result =~ ^No.syntax.errors.*$ ]] ; then
globalResult+="$result | "
fi
fi
done
if [[ -z $globalResult ]] ; then
echo "0 php_syntax_check - OK"
else
echo "2 php_syntax_check - $globalResult"
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment