So I created a simple bash script to compare dates of the current date and
last date of a directory that was last modified.
What I am looking for is something done in Ansible that can take the
converted date string of two variables and subtract the difference.
We have these DAT MacAfee files, I just don’t like the bash script I
created and looking for something that can be done with a yaml playbook.
So here is my script:
#!/bin/bash
# TO PRINT THE NUMBER OF DAYS SINCE LAST AV UPDATE
past_date=$(du -h --time testdate | grep -Eo
'[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2}')
# Perform a subtraction of past_date string
# from today's string divided by seconds times 12 hour days
diff=$((($(date +%s)-$(date +%s --date "$past_date"))/(3600*24)))
echo It has been $diff days since the last AV DAT update
Thanks in advance.
Andy Magana
Oklahoma, City OK
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/48624339-9ab3-45aa-bd25-28a129ea2300%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.