I am using the following shell script to fetch data from the database,and in these fetched data I have a field named 'frequency', then I need to set the script to run according to this frequency.Can I handle this functionality in the script so that it will tell the crone job to run it frequently?
#! /bin/bash
######## Settings ########
BASE_DIR_PATH='/var/www/html/aer/'
######## End Settings ########
CUS_PHP_FILE_PATH='shd/save_customer_info.php'
EMAIL_PHP_FILE_PATH='shd/email_customer_report.php'
CUSTOMER_REPORT_STORAGE_DIRECTORY='ev/customer_report/'
COMPLETED_CUSTOMER_REPORT_STORAGE_DIRECTORY='ev/rty'
LOG_DIRECTORY='ev/customer_report/logs'
DB_PHP_FILE='db/db_config.php'
#Obtain FTP server credentials from database
DB_FILE_NAME="$BASE_DIR_PATH$DB_PHP_FILE"
DB_NAME=`cat $DB_FILE_NAME | grep DB_DATABASE | cut -d \' -f 4`
DB_USERNAME=`cat $DB_FILE_NAME | grep DB_SERVER_USERNAME | cut -d \' -f
4`
DB_PASSWORD=`cat $DB_FILE_NAME | grep DB_SERVER_PASSWORD | cut -d \' -f
4`
FTP_PROFILE='bgty'
SYSTEM_PACKAGE='bfgtt'
results=($(mysql --user $DB_USERNAME -p${DB_PASSWORD} ${DB_NAME} -Bse
"SELECT api_url,api_user_name,api_password,frequency FROM
brt_profile WHERE profile_name='$FTP_PROFILE' AND
distributor='$SYSTEM_PACKAGE'"))
if [ $? -ne 0 ]; #check if database connection is failed
then
exit
fi