Commit bb8b7534bcd6579c7087ccb90051eceede4e1b98

Authored by Kevin Fourie
1 parent 3294d620

KTS-3496

"Error (warning fopen) when opening ktdms application under Linux"
Fixed. Added chown to nobody on script init if current user is root.

Committed By: Kevin Fourie
Reviewed By: Conrad Vermeulen 


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@8798 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 12 additions and 1 deletions
bin/scheduler.php
@@ -51,6 +51,17 @@ if(file_exists($lock)){ @@ -51,6 +51,17 @@ if(file_exists($lock)){
51 exit(0); 51 exit(0);
52 } 52 }
53 53
  54 +// If this is *nix and we are root then make sure file permisions are correct
  55 +if(!OS_WINDOWS && (get_current_user() == 'root'))
  56 +{
  57 + // The log files...
  58 + try {
  59 + $default->log->debug( 'Scheduler: setting owner to nobody on - '.$default->logDirectory);
  60 + exec('chown -R nobody:0 '.escapeshellcmd($default->logDirectory));
  61 + } catch(Exception $e) {
  62 + $default->log->debug('Scheduler: can\'t set owner to nobody - '.$e);
  63 + }
  64 +}
54 65
55 /* ** Set up functions ** */ 66 /* ** Set up functions ** */
56 67
@@ -262,4 +273,4 @@ if (empty($aList)) @@ -262,4 +273,4 @@ if (empty($aList))
262 273
263 $default->log->debug('Scheduler: stopping'); 274 $default->log->debug('Scheduler: stopping');
264 275
265 -?>  
266 \ No newline at end of file 276 \ No newline at end of file
  277 +?>