SupervisorMaker new
This commit is contained in:
1 parent
e7814b4ddd
commit
35f1dae5e3
17 files changed
+21
-74
No files matched your search
@@ -4,6 +4,7 @@ namespace App\Actions;
|
|||||||
|
|
||||||
use App\Models\Supervisor;
|
use App\Models\Supervisor;
|
||||||
use App\Utilities\Notice;
|
use App\Utilities\Notice;
|
||||||
|
use Illuminate\Filesystem\Filesystem;
|
||||||
|
|
||||||
class SupervisorMaker
|
class SupervisorMaker
|
||||||
{
|
{
|
||||||
@@ -15,23 +16,32 @@ class SupervisorMaker
|
|||||||
{
|
{
|
||||||
$supervisors = Supervisor::all();
|
$supervisors = Supervisor::all();
|
||||||
|
|
||||||
|
$path = base_path().'/supervisor/nuh';
|
||||||
|
|
||||||
|
if (! is_dir($path)) {
|
||||||
|
mkdir($path, 0777);
|
||||||
|
}
|
||||||
|
|
||||||
|
$file = new Filesystem;
|
||||||
|
$file->cleanDirectory($path);
|
||||||
|
|
||||||
foreach ($supervisors as $supervisor) {
|
foreach ($supervisors as $supervisor) {
|
||||||
|
|
||||||
$dirname = self::fix_string($supervisor->provider->name);
|
$parts = [];
|
||||||
|
$parts[] = 'p'.$supervisor->id;
|
||||||
$path = base_path().'/supervisor/'.strtolower($dirname);
|
$parts[] = $supervisor->sport->name ?? 'all';
|
||||||
|
$parts[] = self::fix_string($supervisor->provider->name);
|
||||||
if (! is_dir($path)) {
|
if ($supervisor->name) {
|
||||||
mkdir($path, 0777);
|
$parts[] = self::fix_string($supervisor->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sport = self::fix_string($supervisor->sport?->name) ?? 'all';
|
|
||||||
$process = 'p'.$supervisor->id.'_'.self::fix_string($supervisor->name).'_'.$sport;
|
|
||||||
if ($supervisor->days_to) {
|
if ($supervisor->days_to) {
|
||||||
$process .= '_'.$supervisor->days_from;
|
$parts[] = 'day'.$supervisor->days_from;
|
||||||
$process .= '_'.$supervisor->days_to;
|
$parts[] = 'day'.$supervisor->days_to;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$process = strtolower(implode('_', $parts));
|
||||||
|
|
||||||
$content = '[program:'.$process.']'.PHP_EOL;
|
$content = '[program:'.$process.']'.PHP_EOL;
|
||||||
if ($supervisor->commandline_options != '') {
|
if ($supervisor->commandline_options != '') {
|
||||||
$content .= 'command=/usr/bin/php '.base_path().'/artisan nuh '.$supervisor->id.' '.$supervisor->commandline_options.PHP_EOL;
|
$content .= 'command=/usr/bin/php '.base_path().'/artisan nuh '.$supervisor->id.' '.$supervisor->commandline_options.PHP_EOL;
|
||||||
@@ -45,10 +55,6 @@ class SupervisorMaker
|
|||||||
if ($supervisor->is_active && $supervisor->is_supervisor) {
|
if ($supervisor->is_active && $supervisor->is_supervisor) {
|
||||||
file_put_contents($file, $content);
|
file_put_contents($file, $content);
|
||||||
chmod($file, 0777);
|
chmod($file, 0777);
|
||||||
} else {
|
|
||||||
if (is_file($file)) {
|
|
||||||
unlink($file);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -137,6 +137,7 @@ class SupervisorsTable
|
|||||||
}),
|
}),
|
||||||
TextInputColumn::make('sleep')->prefix('Seep'),
|
TextInputColumn::make('sleep')->prefix('Seep'),
|
||||||
TextInputColumn::make('commandline_options')->prefix('Bash')
|
TextInputColumn::make('commandline_options')->prefix('Bash')
|
||||||
|
->tooltip('command used in supervisor script')
|
||||||
->hidden(function (ListSupervisors $livewire) {
|
->hidden(function (ListSupervisors $livewire) {
|
||||||
return $livewire->tableFilters['provider_id']['value'] == 8;
|
return $livewire->tableFilters['provider_id']['value'] == 8;
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
[program:p6_bet365_]
|
|
||||||
command=/usr/bin/php /Users/salam/Sites/nuhodds_fi4/artisan nuh 6
|
|
||||||
autostart=true
|
|
||||||
autorestart=true
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
[program:p16_odds_soccer]
|
|
||||||
command=/usr/bin/php /Users/salam/Sites/nuhodds_fi4/artisan nuh 16
|
|
||||||
autostart=true
|
|
||||||
autorestart=true
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
[program:p17_odds_basketball]
|
|
||||||
command=/usr/bin/php /Users/salam/Sites/nuhodds_fi4/artisan nuh 17
|
|
||||||
autostart=true
|
|
||||||
autorestart=true
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
[program:p18_odds_ice_hockey]
|
|
||||||
command=/usr/bin/php /Users/salam/Sites/nuhodds_fi4/artisan nuh 18
|
|
||||||
autostart=true
|
|
||||||
autorestart=true
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
[program:p19_odds_tennis]
|
|
||||||
command=/usr/bin/php /Users/salam/Sites/nuhodds_fi4/artisan nuh 19
|
|
||||||
autostart=true
|
|
||||||
autorestart=true
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
[program:p12_odds_soccer]
|
|
||||||
command=/usr/bin/php /Users/salam/Sites/nuhodds_fi4/artisan nuh 12
|
|
||||||
autostart=true
|
|
||||||
autorestart=true
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
[program:p13_odds_basketball]
|
|
||||||
command=/usr/bin/php /Users/salam/Sites/nuhodds_fi4/artisan nuh 13
|
|
||||||
autostart=true
|
|
||||||
autorestart=true
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
[program:p14_odds_ice_hockey]
|
|
||||||
command=/usr/bin/php /Users/salam/Sites/nuhodds_fi4/artisan nuh 14
|
|
||||||
autostart=true
|
|
||||||
autorestart=true
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
[program:p15_odds_tennis]
|
|
||||||
command=/usr/bin/php /Users/salam/Sites/nuhodds_fi4/artisan nuh 15
|
|
||||||
autostart=true
|
|
||||||
autorestart=true
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
[program:p11_odds_]
|
|
||||||
command=/usr/bin/php /Users/salam/Sites/nuhodds_fi4/artisan nuh 11
|
|
||||||
autostart=true
|
|
||||||
autorestart=true
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
[program:p9_odds_]
|
|
||||||
command=/usr/bin/php /Users/salam/Sites/nuhodds_fi4/artisan nuh 9
|
|
||||||
autostart=true
|
|
||||||
autorestart=true
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
[program:p20_odds_basketball_0_10]
|
|
||||||
command=/usr/bin/php /Users/salam/Sites/nuhodds_fi4/artisan nuh 20
|
|
||||||
autostart=true
|
|
||||||
autorestart=true
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
[program:p21_odds_ice_hockey_0_10]
|
|
||||||
command=/usr/bin/php /Users/salam/Sites/nuhodds_fi4/artisan nuh 21
|
|
||||||
autostart=true
|
|
||||||
autorestart=true
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
[program:p22_odds_tennis_0_10]
|
|
||||||
command=/usr/bin/php /Users/salam/Sites/nuhodds_fi4/artisan nuh 22
|
|
||||||
autostart=true
|
|
||||||
autorestart=true
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
[program:p2_odds_soccer_0_10]
|
|
||||||
command=/usr/bin/php /Users/salam/Sites/nuhodds_fi4/artisan nuh 2
|
|
||||||
autostart=true
|
|
||||||
autorestart=true
|
|
||||||
Reference in new issue
Block a user