Lines Matching +full:run +full:- +full:script

2 // must be run within Dokuwiki
10 $this->temp_dir = $conf['tmpdir'].'/maintenance';
11 $this->script_last_log_file = $this->temp_dir.'/last.log';
12 $this->script_last_pid_file = $this->temp_dir.'/last.pid';
13 $this->script_last_script_file = $this->temp_dir.'/last.script';
14 $this->manual_lock_file = $this->temp_dir.'/.lock';
19 putenv('LANG='."en_US.UTF-8");
23 * Gets the configured script
26 $script = $this->getConf('script');
27 $script = str_replace(
29 array(substr(DOKU_INC, 0, -1), dirname(__FILE__).'/bin'),
30 $script );
31 return $script;
39 $locks = glob($this->temp_dir.'/*.lock');
41 if (is_file($this->temp_dir.'/.lock')) return 1;
46 * Runs a script and locks the site during running
48 * @return integer 2: already run, 1: success, 0: fail
50 function script_start($script) { argument
51 $script_hash = sha1($script);
52 $lockfile = $this->temp_dir.'/'.$script_hash.'.lock';
56 …$cmd = 'nohup bash '.escapeshellarg($script).' > '.escapeshellarg($this->script_last_log_file). ' …
59 file_put_contents($this->script_last_pid_file, $output[0]);
60 file_put_contents($this->script_last_script_file, $script_hash);
67 * Kills the last started script
69 * @return integer 2: already not run, 1: success, 0: fail
72 $script_hash = trim(file_get_contents($this->script_last_script_file));
73 $lockfile = $this->temp_dir.'/'.$script_hash.'.lock';
74 $result = $this->script_updatelock($lockfile);
76 $pid = trim(file_get_contents($this->script_last_pid_file));
77 $cmd = "ps p $pid >&-";
80 $cmd = "kill -9 $pid";
87 * Checks whether it's time to run
90 $file = $this->script_last_pid_file;
92 $interval = $this->getConf('script_auto_interval');
99 * Checks all script locks
103 $locks = glob($this->temp_dir.'/*.lock');
105 $this->script_updatelock($lock);
110 * Checks a script lock and removes it if already terminated
132 if (is_file($this->manual_lock_file)) return 2;
133 @io_mkdir_p(dirname($this->manual_lock_file));
134 @touch($this->manual_lock_file);
135 if (is_file($this->manual_lock_file)) return 1;
145 if (!is_file($this->manual_lock_file)) return 2;
146 @unlink($this->manual_lock_file);
147 if (!is_file($this->manual_lock_file)) return 1;