forked from nextcloud-snap/nextcloud-snap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nextcloud: migration: add nextcloud config
maintenance_window_start
- Loading branch information
1 parent
70a8347
commit 3acd7e1
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
src/migrations/migrations/28.0.2snap1/1_add-maintenance-window-start.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |