From ad73b306655930b42e707c8b9dea377db0a007e3 Mon Sep 17 00:00:00 2001 From: Ubergeek Date: Mon, 18 Mar 2019 11:57:37 +0000 Subject: [PATCH] Cleaned up a bit --- githook.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/githook.php b/githook.php index 463985c..e189f82 100644 --- a/githook.php +++ b/githook.php @@ -5,6 +5,7 @@ /* security */ $access_token = '1234567890'; $lastrun = '/tmp/ansible-hook-last-run'; +$dropfile = '/tmp/run-ansible'; /* get json data */ $json = file_get_contents('php://input'); @@ -23,9 +24,9 @@ syslog(LOG_INFO, 'Ansible Webhook recieved.'); //fwrite($fs, 'DATA: '.print_r($data, true).PHP_EOL); -if (time()-filemtime($lastrun) > 300) { - exec("/usr/bin/touch /tmp/run_ansible"); - touch ($lastrun); +if ( time () - filemtime ( $lastrun ) > 300 ) { + touch ( $dopfile ); + touch ( $lastrun ); echo "HTTP 200 - Ansible webhook recieved."; } else {