Why you can’t copy using ftp in freebsd with cron

Do you use a ftp transfer script like below and you did a crontab edit in “/etc/crontab” ?

Then don’t, just use crontab -e in pfsense shell and add your cron entry to there. There is an access issue occuring with cron daemon and cron entries.. We couldn’t manage to find the problem but we’ve resolved that using user-based cron entries and please use nano as crontab editor.

additional notes;

  • Curl strips new line so if you transfer your text files with -T parameter to windows machines the output will lost its text formatting
  • Same thing with ftp -u ftp://user:pass@server/file file_should_be_copied.
  • Lftp is not ported to freebsd so you have to build from tarballs which immediately gives you bazillion dependency errors.
  • No unix2dos port :( shame.
  • Don’t create your script in windows then upload it to freebsd, it creates a coding problem so your script will be run partially if you have special characters like “ğ”. Just write it nano the script and paste your content.
  • You have to make it run with the sample script below.

###
ftp -n -v $HOST << EOT
ascii
user $USER $PASSWD
prompt
put FormTIB5651.txt dhcplog$tarih.txt
bye
EOT
###