1

I run some cron jobs on my Pi. I want to find a way to export all from a command to a file ie:

logwatch --yesterday --medium --archive > 'name_of_my_file'

where 'name_of_my_file' will be as a format EU dd-mm-yyy hh:mm

if you could share as well any ideas how to upload those files to external ftp server it will be great!

1 Answer 1

3

You can easily get a date in any format, although I would use an ISO8601 format, which has the advantage of being unambiguous and sortable e.g.

date "+%Y%m%dT%H%M%S"

gives

20131116T122633

You can use this in a script to construct your file name, using any other characters to construct the name.

echo Test > File`date "+%Y%m%dT%H%M%S"`.txt

Not the answer you're looking for? Browse other questions tagged or ask your own question.