Skip to content

Commit 7cfcc29

Browse files
authored
Merge pull request #55 from mrrobot47/global/cron
Shift cron to global service
2 parents b146527 + a7ce810 commit 7cfcc29

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

cron-command.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
}
66

77
if ( ! defined( 'EE_CRON_SCHEDULER' ) ) {
8-
define( 'EE_CRON_SCHEDULER', 'ee-cron-scheduler' );
8+
define( 'EE_CRON_SCHEDULER', 'services_global-cron_1' );
99
}
1010

1111
$autoload = dirname( __FILE__ ) . '/vendor/autoload.php';

src/Cron_Command.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,7 @@ class Cron_Command extends EE_Command {
6868
*/
6969
public function create( $args, $assoc_args ) {
7070

71-
if ( 'running' !== EE_DOCKER::container_status( EE_CRON_SCHEDULER ) ) {
72-
$img_versions = \EE\Utils\get_image_versions();
73-
$cron_scheduler_run_command = 'docker run --name ' . EE_CRON_SCHEDULER . ' --restart=always -d -v ' . EE_ROOT_DIR . '/services/cron:/etc/ofelia:ro -v /var/run/docker.sock:/var/run/docker.sock:ro easyengine/cron:' . $img_versions['easyengine/cron'];
74-
if ( ! EE_DOCKER::boot_container( EE_CRON_SCHEDULER, $cron_scheduler_run_command ) ) {
75-
EE::error( 'There was some error in starting ' . EE_CRON_SCHEDULER . ' container. Please check logs.' );
76-
}
77-
}
71+
\EE\Service\Utils\init_global_container( GLOBAL_CRON );
7872

7973
EE\Utils\delem_log( 'ee cron add start' );
8074

src/helper/utils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
function update_cron_config() {
1212

1313
$config = generate_cron_config();
14-
file_put_contents( EE_ROOT_DIR . '/services/cron/config.ini', $config );
14+
file_put_contents( EE_SERVICE_DIR . '/cron/conf/config.ini', $config );
1515
\EE_DOCKER::restart_container( EE_CRON_SCHEDULER );
1616
}
1717

0 commit comments

Comments
 (0)