update
This commit is contained in:
parent
32b03d08eb
commit
38b57104d6
2 changed files with 20 additions and 0 deletions
8
bin/delete-cron-job.sh
Normal file
8
bin/delete-cron-job.sh
Normal file
|
@ -0,0 +1,8 @@
|
|||
username=$1
|
||||
schedule=$2
|
||||
command=$3
|
||||
|
||||
# Get the user's crontab, filter out the specific command and schedule, and install the updated crontab
|
||||
crontab -u $username -l | grep -v -F "$schedule $command" | crontab -u $username -
|
||||
|
||||
echo "done!"
|
|
@ -33,6 +33,18 @@ class CronJob extends Model
|
|||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
static::deleting(function ($model) {
|
||||
|
||||
$args = escapeshellarg($model->user) .' '. escapeshellarg($model->schedule) . ' ' . escapeshellarg($model->command);
|
||||
$args = str_replace(PHP_EOL, '', $args);
|
||||
$command = '/usr/local/phyre/bin/delete-cron-job.sh ' . $args;
|
||||
$deleteCron = shell_exec($command);
|
||||
if (empty($deleteCron)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// protected function sushiShouldCache()
|
||||
|
|
Loading…
Reference in a new issue