I have a file in fleetctl let's call it [email protected] And I have a local file let's call it [email protected]
I want to check if they are different or not. If they are different I will initiate a destroy and start command, but I can't find the way to diff between them..
What I did is built a script:
check_diff ()
{
    # Check if local file is diff from fleetctl file "[email protected]"
    # [email protected] is currently active in the fleetctl
    # Looking for something like
      diff (fleetctl list-units | grep $1 | head -n 1 | awk '{print $1}') $1.service
}
# Get local file names and push them to the function
for unit in $(ls -l | awk '{print $9}' | grep -e \.service); do
  check_diff ${unit%.*} # Will result unit as "file@"
done
				
                        
Solution:
Found the solution
Then just check the $DIFF var