0

I'm trying to make a bash file (.sh) then when a file gets transferred it executes. This is the code:

        #!/bin/sh

        cd /files/usrdev/upload/datalake/GB/SQL/
        FILE=CTL_MGB_????????.txt
        INSTANCE=pevm-etlm001
        PROJECT=pe-datalake01-dev
        ZONE=us-east1-b

        if [ -s "$FILE" ]; then
                gcloud compute instances start "$INSTANCE" --zone="$ZONE" --project="$PROJECT" 
        fi

When the file CTL_MGB_????????.txt (the ???????? is a date YYYYMMDD with this format). I'm trying to use this sentence: if [ -s "$FILE" ]; then checks if the file exists and if it does it should start a compute engine in google cloud. When I executed it works, but I don't know how to make it automatically.

  • Take a look at [incron](http://inotify.aiken.cz/?section=incron&page=doc&lang=en), and the inotify-tools suite in general. – Charles Duffy Jul 19 '21 at 20:52

0 Answers0