Created
July 23, 2015 07:37
-
-
Save hjue/f19210fd48db864ffc38 to your computer and use it in GitHub Desktop.
run php code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| ulimit -f 64 -m 64 -t 2 -u 128 | |
| [[ ! -d /out/$1/ ]] && mkdir /out/$1/ || chmod u+w /out/$1/ | |
| for bin in /bin/php-* | |
| do | |
| echo $bin - $1 | |
| nice -n 15 sudo -u nobody $bin -c /etc/ -q "/in/$1" &>/out/$1/${bin##*-} & PID=$! | |
| ( sleep 3.1; kill -9 $PID 2>/dev/null ) & | |
| wait $PID | |
| ex=$? | |
| sf=/out/$1/${bin##*-}-exit | |
| [[ $ex -eq 0 && -f $sf ]] && rm $sf | |
| [[ $ex -ne 0 ]] && echo -n $ex > $sf | |
| done | |
| chmod u-w /out/$1/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment