Skip to content

Commit

Permalink
Merge pull request #55 from mrrobot47/global/cron
Browse files Browse the repository at this point in the history
Shift cron to global service
  • Loading branch information
mrrobot47 authored Jan 13, 2023
2 parents b146527 + a7ce810 commit 7cfcc29
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cron-command.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
}

if ( ! defined( 'EE_CRON_SCHEDULER' ) ) {
define( 'EE_CRON_SCHEDULER', 'ee-cron-scheduler' );
define( 'EE_CRON_SCHEDULER', 'services_global-cron_1' );
}

$autoload = dirname( __FILE__ ) . '/vendor/autoload.php';
Expand Down
8 changes: 1 addition & 7 deletions src/Cron_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,7 @@ class Cron_Command extends EE_Command {
*/
public function create( $args, $assoc_args ) {

if ( 'running' !== EE_DOCKER::container_status( EE_CRON_SCHEDULER ) ) {
$img_versions = \EE\Utils\get_image_versions();
$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'];
if ( ! EE_DOCKER::boot_container( EE_CRON_SCHEDULER, $cron_scheduler_run_command ) ) {
EE::error( 'There was some error in starting ' . EE_CRON_SCHEDULER . ' container. Please check logs.' );
}
}
\EE\Service\Utils\init_global_container( GLOBAL_CRON );

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

Expand Down
2 changes: 1 addition & 1 deletion src/helper/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
function update_cron_config() {

$config = generate_cron_config();
file_put_contents( EE_ROOT_DIR . '/services/cron/config.ini', $config );
file_put_contents( EE_SERVICE_DIR . '/cron/conf/config.ini', $config );
\EE_DOCKER::restart_container( EE_CRON_SCHEDULER );
}

Expand Down

0 comments on commit 7cfcc29

Please sign in to comment.