Skip to content

Commit

Permalink
nextcloud: migration: add nextcloud config maintenance_window_start
Browse files Browse the repository at this point in the history
  • Loading branch information
Pilzinsel64 committed Apr 9, 2024
1 parent 70a8347 commit 3acd7e1
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# Starting from Version 28 Nextcloud recommends to set a default time window for resource heavy background jobs.
# See https://docs.nextcloud.com/server/28/admin_manual/configuration_server/background_jobs_configuration.html#maintenance-window-start

# Path to config.php file
config_file="/var/snap/nextcloud/current/nextcloud/config/config.php"

# Searching text (config name)
search_text="maintenance_window_start"

# New config text
insert_text=" 'maintenance_window_start' => 1,"

# Check if config name exists
if grep -q "$search_text" "$config_file"; then
echo "The text '$search_text' is already available in the config file '$config_file'."
else
# Paste the the default config value in the last line
sed -i '$i\'"$insert_text" "$config_file"
echo "The text '$insert_text' has been added to the config file '$config_file'."
fi

0 comments on commit 3acd7e1

Please sign in to comment.