2

I am working on a CI runner in GitLab which is supposed to transfer changed files via FTP to a development environment.

lftp seemed to be a good solution for doing so as it's easy to use and not overly complicated.

I am using this to transfer files:

lftp -c "set ftp:ssl-allow no; open -u $USERNAME_DEV,$PASSWORD_DEV $HOST_DEV; mirror -Rvpn -O $PATH_DEV --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/"

The problematic part is the -Rvpn parameter set, specifically the -n. This is supposed to mirror only newer files which will most probably work by checking file change times.

Now my repository uses the correct time but my server is one hour in advance (GMT+2 instead of +1) which will lead to a false when checking for newer files.

I could remove the -n but then the whole repository would be cloned, not only the changed (and therefore newer) files.

Is there any way to define a time offset for lftp, so it adds +1 hour to the file change date or something similar? I checked the manual but did not find anything like that.

2
  • 1
    If you look at the config you can set ftp:timezone (string), that could correct the value. In addition you might be able to utilize --ignore-time, --newer-than=SPEC or --older-than=SPEC.
    – Seth
    Commented Mar 16, 2017 at 9:44
  • I will try that in a minute. Would you add it as an answer so I can mark it as the correct answer?
    – flomei
    Commented Mar 16, 2017 at 9:47

1 Answer 1

2

If you look at the manual you've linked lftp has an option that enables you to define the timezone for the remote site. It might be worth it to try to set it and see whenever lftp correctly compensates.

ftp:timezone (string)

Assume this timezone for time in listings returned by LIST command. This setting can be GMT offset [+|-]HH[:MM[:SS]] or any valid TZ value (e.g. Europe/Moscow or MSK-3MSD,M3.5.0,M10.5.0/3). The default is GMT. Set it to an empty value to assume local timezone specified by environment variable TZ.

In addition it has a switch to ignore the time (--ignore-time which might enable you to make it rely only on file size and some switches (--newer-than and --older-than) to define a time "that matters" so you might be able to set it up in a way that not all files are transfered.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .