mirror of
https://github.com/deployphp/deployer.git
synced 2025-03-14 18:29:41 +01:00
Contrib: generate random crontab tmp path (#3068)
Co-authored-by: Dumazeau <hdumazeau@richcongress.com>
This commit is contained in:
parent
6cec2890f4
commit
e374a8e2c1
@ -91,17 +91,19 @@ task('crontab:sync', function () {
|
||||
}
|
||||
}
|
||||
|
||||
if (test ("[ -f '/tmp/crontab_save' ]")) {
|
||||
run ("unlink '/tmp/crontab_save'");
|
||||
$tmpCrontabPath = \sprintf('/tmp/%s', \uniqid('crontab_save_'));
|
||||
|
||||
if (test("[ -f '$tmpCrontabPath' ]")) {
|
||||
run("unlink '$tmpCrontabPath'");
|
||||
}
|
||||
|
||||
foreach ($cronJobs as $cronJob) {
|
||||
$jobString = $cronJob['minute'] . ' ' . $cronJob['hour'] . ' ' . $cronJob['day'] . ' ' . $cronJob['month'] . ' ' . $cronJob['weekday'] . ' ' . $cronJob['cmd'];
|
||||
run ("echo '" . $jobString . "' >> '/tmp/crontab_save'");
|
||||
run("echo '" . $jobString . "' >> $tmpCrontabPath");
|
||||
}
|
||||
|
||||
run ("{{bin/crontab}} /tmp/crontab_save");
|
||||
run ('unlink /tmp/crontab_save');
|
||||
run('{{bin/crontab}} ' . $tmpCrontabPath);
|
||||
run('unlink ' . $tmpCrontabPath);
|
||||
});
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user