Good morning. I have some doubts regarding a project that I am finishing using linux (I do not have much domain).
I have a program written in C that generates .txt files, I should make this program run every day (until then, I know I should use crontab functionality). After this file is generated I send it to a server via FTP. At this point I do not know how to proceed, since I must access the directory that the file was generated, open connection with FTP and send it.
Another question I'm having is, what is the advantage of using a send to a server through the FTP protocol?
Edit 1:
I made the script and it works until I pass in the variable file the source file and the source file, however it is necessary to declare a new name, and I would just like to duplicate the files from one place to another.
Following script:
#!/bin/bash
HOST='192.168.8.151'
usuario='ftp_tentativas'
senha='passwdwillian01'
arquivo='/var/www/html/log/Export/*.csv'
ftp -n $HOST <<END_SCRIPT
user ${usuario} ${senha}
cd recebe
put $arquivo
cp /var/www/html/log/Export/*.* /var/www/html/log/Enviados/.
rm /var/www/html/log/Export/*.*
quit
END_SCRIPT
exit 0
Error presenting:
?Invalid command
Could not create file.
Remove directory operation failed.
When done 'by hand' directly by the console it shows the destination equal to the source, not creating the file correctly.
ftp> put /var/www/html/log/Export/*.csv
local: /var/www/html/log/Export/Relatorio_Qualidade_20180730.csv remote: /var/www/html/log/Export/Relatorio_Qualidade_20180730.csv
227 Entering Passive Mode (192,168,8,111,109,45).
553 Could not create file.