Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

2. Edit the script and add the following lines in the main_setup() routine, after the line set_up_process_commandline_arguments "$@":

Code Block
languagebash
themeRDark
     #############################################
    # Permamently enable debug mode

    # log rotation
    logfile=/var/log/agent.out
    max_logs=10  # Adjust the maximum number of stored log files to your needs.
    i=$max_logs

    while [ $i -gt 1 ]; do
        ((j=i-1))
        if [ -f $logfile.$j ]; then
            mv $logfile.$j $logfile.$i
        fi
        i=$j
    done

    if [ -f $logfile ]; then
        mv $logfile $logfile.1
    fi

    # write stderr to log
    set -xv
    exec 2>$logfile

    # Enabling debug END
    ############################################# 

...