'' and dataorder.ts_approved=now()-interval '4 months' and dataorder.selection is null"; $result = pg_query($link, $sql); $numrows = pg_num_rows($result); $content=''; for($ri = 0; $ri < $numrows; $ri++) { $row = pg_fetch_array($result, $ri); $content.='# path: '.$row['path']."\n"; $content.='umount "/home/ftp/westdc_'.$row['userid'].'/'.preg_replace('/^.+[\\\\\\/]/', '', rtrim($row['path'],'/')).'"'."\n"; } $filename='./ftp-umount.sh'; if (!empty($content)) if (!file_put_contents($filename, $content, LOCK_EX)) { sleep(1); if (!file_put_contents($filename, $content, LOCK_EX)) { sleep(1); if (!file_put_contents($filename, $content, LOCK_EX)) die("error in write proftp-user.sh"); } } pg_free_result($result); pg_close($link); ?>