diff --git a/database/seeders/RecommendedSettingsSeeder.php b/database/seeders/RecommendedSettingsSeeder.php index 225b8c8f..16100f73 100644 --- a/database/seeders/RecommendedSettingsSeeder.php +++ b/database/seeders/RecommendedSettingsSeeder.php @@ -122,7 +122,7 @@ private function createDefaultSettings() 'default_setting_category' => 'mobile_apps', 'default_setting_subcategory' => 'mobile_app_conn_protocol', 'default_setting_name' => 'text', - 'default_setting_value' => 'sips', + 'default_setting_value' => 'sip', 'default_setting_enabled' => true, 'default_setting_description' => "Options: sip or tcp or sips", ], diff --git a/install/install.sh b/install/install.sh index a709be75..7be1b8dd 100644 --- a/install/install.sh +++ b/install/install.sh @@ -114,6 +114,15 @@ else exit 1 fi +# Include the install_cron_jobs.sh script +sh /var/www/fspbx/install/install_cron_jobs.sh +if [ $? -eq 0 ]; then + print_success "Cron bob installation script executed successfully." +else + print_error "Error occurred while executing cron job installation script." + exit 1 +fi + # Include the add_web_server_to_sudoers.sh script sh /var/www/fspbx/install/add_web_server_to_sudoers.sh if [ $? -eq 0 ]; then diff --git a/install/install_cron_jobs.sh b/install/install_cron_jobs.sh new file mode 100644 index 00000000..74f5bab5 --- /dev/null +++ b/install/install_cron_jobs.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +# Function to print success message +print_success() { + echo "\033[32m$1 \033[0m" # Green text +} + +# Function to print error message +print_error() { + echo "\033[31m$1 \033[0m" # Red text +} + +# Define the cron job entries as a string +CRON_JOBS=" +* * * * * cd /var/www/fspbx; /usr/bin/php /var/www/fspbx/public/app/xml_cdr/xml_cdr_import.php 100 abcdef >/dev/null 2>&1 +* * * * * cd /var/www/fspbx; /usr/bin/php /var/www/fspbx/public/app/xml_cdr/xml_cdr_import.php 100 01234 >/dev/null 2>&1 +* * * * * cd /var/www/fspbx; /usr/bin/php /var/www/fspbx/public/app/xml_cdr/xml_cdr_import.php 100 56789 >/dev/null 2>&1 +* * * * * cd /var/www/fspbx && php artisan schedule:run >> /dev/null 2>&1 +" + +# Backup the existing crontab +CRON_FILE=$(mktemp) +crontab -l > "$CRON_FILE" 2>/dev/null || true + +# Loop through each cron job and add it if it doesn't exist +echo "$CRON_JOBS" | while read -r job; do + if [ -n "$job" ] && ! grep -Fxq "$job" "$CRON_FILE"; then + echo "$job" >> "$CRON_FILE" + echo "Added cron job: $job" + else + echo "Cron job already exists: $job" + fi +done + +# Apply the updated crontab +crontab "$CRON_FILE" && rm "$CRON_FILE" +if [ $? -eq 0 ]; then + print_success "Cron jobs updated successfully." +else + print_error "Failed to update cron jobs." + exit 1 +fi