Mitto CMD job - Multi-Line Support (>=2.9)

Had the opportunity to explore an exciting new feature in Mitto Command Line jobs: Multi-line commands.

Previously in Mitto, CMD jobs only allowed one line of code. So you either had to string multiple commands together with && or you had to write a bash script and run that.

For example: In a previous version of mitto we might have had a CMD job that ran a bash script that checked for the existence of a CSV file with today’s date, then did something with the file.

The old command for the CMD job was bash /var/mitto/data/ > log-output.txt 2>&1

This ran a script in the Mitto files directory, and output to a log file.

Starting in Mitto 2.9, since we now support multi-line commands, this can all be done without the use of a script. The new job config (hjson!) would look like this:

  shell: true
    exec 1>/var/mitto/data/log-output.txt
    filename="filename_`date --date=today +%Y_%m_%d`.csv"
    cd /var/mitto/data
    filename=`ls $filename`
    if [ -z "$filename" ]
        echo "file does not exist"
        exit 1
    echo "file exists"
    # do something with file
  exec: false
  timeout: null
  cmd_env: {
1 Like