Skip to content

Commit

Permalink
try kicking off script via cron
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfinnarn committed Feb 7, 2024
1 parent 86b14b7 commit 477313c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .tugboat/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,9 @@ services:
- chmod +x /etc/service/drupal_events/run

# Separate process for next-build preview.
- mkdir -p /etc/service/next-build
- mv "${TUGBOAT_ROOT}/scripts/queue_runner/next_queue_runner.sh" /etc/service/next-build/run
- chmod +x /etc/service/next-build/run
# - mkdir -p /etc/service/next-build
# - mv "${TUGBOAT_ROOT}/scripts/queue_runner/next_queue_runner.sh" /etc/service/next-build/run
# - chmod +x /etc/service/next-build/run

clone:
# This j2 command is shared in both the build & clone stages. If modifying, change the other too.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
];

// Check for the existence of the .next-build.txt.
$file = 'public://.next-buildlock';
$file = 'public://next-buildlock.txt';
$file_path = \Drupal::service('file_system')->realpath($file);
if (file_exists($file_path)) {
$form['build_request']['next_build_selection']['#disabled'] = TRUE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,18 @@
* @file
* Contains va_gov_content_release.module.
*/

/**
* Implements hook_cron().
*/
function va_gov_content_release_cron(): void {
// Run script in dirname(DRUPAL_ROOT) directory.
$script = dirname(DRUPAL_ROOT) . '/scripts/queue_runner/next_queue_runner.sh';
// Run script in background if it exists.
if (file_exists($script)) {
exec("nohup $script > /dev/null 2>&1 &");
}
else {
\Drupal::logger('va_gov_content_release')->error('Queue runner script not found at %script', ['%script' => $script]);
}
}
3 changes: 2 additions & 1 deletion scripts/queue_runner/next_queue_runner.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash -l

cd "${TUGBOAT_ROOT}"
ROOT=${TUGBOAT_ROOT:-${DDEV_APPROOT:-/var/www/html}}
cd "${ROOT}"
[ -f "./docroot/sites/default/files/next-buildrequest.txt" ] && ./scripts/next-build-frontend.sh
sleep 10s

0 comments on commit 477313c

Please sign in to comment.