I've tried several times to test my script, but with no success. This is the script:
zenity --question --text "my text"
if [ $? -eq 1 ]; then
zenity --warning --text "my text"
else
ping -n -c1 192.168.180.112
# print result (0 se existir)
echo $?
if [ $? -eq 0 ]; then
scp -r ~/Documents/Processo/CONCLUIDO/* [email protected]:/home/posto-ensaios/Documents/Processo
fileName=$(inotifywait -e moved_from /home/posto-11v/Documents/Processo/CONCLUIDO | sed -r 's/^.*MOVED_FROM(,ISDIR)*\s+(.*)$/\2/g')
mail -s "$fileName" [email protected] < ~/Documents/personaproject/Programa/scripts/mail.txt
mv --backup ~/Documents/Processo/CONCLUIDO/* ~/Documents/personaproject/processos_terminados
zenity --info --text="my text"
else
zenity --warning --text "my text"
fi
fi
I've tried to run with the sleep
command with "pipe" after sed
and to change the order of the commands. When running the script in their terminal the problem is that inotify
always keeps waiting for an action...
I need to guarantee that files are copied, moved and the $filename
is sent in email...
Any help?
Thanks!
mv
command moved a file from the watched directory?