############################################################################################### #!/bin/bash # Name: script_skel.sh # Description: Template wrapper script for script_worker_skel.sh that provides logging. ############################################################################################### ##### Customize These Variables ##### # Log file log_file="${HOME}/script.log" # Name of worker script to execute worker="script_worker_skel.sh" #### End Customize Variables #### # Store this script's name and figure out the base path script_name="$(basename ${0})" base_path=$(echo ${0} | sed "s/${script_name}//") # Clear log and timestamp the beginning echo -e ">>Logging output and errors to: ${log_file}\n" cat /dev/null > ${log_file} echo -e "---- Log Started: $(date) ----\n" >> ${log_file} ## Execute Script ## ${base_path}${worker} 2>&1 | tee -a ${log_file} # Close log file echo -e "\n---- Log Completed: $(date) ----" >> ${log_file} # Reminder of log file location echo -e "\n>>Logged output and errors was sent to: ${log_file}"