Skip to content

Commit cf443a1

Browse files
committed
Use embedded tzdata package
Remove --timezone flag
1 parent 094b758 commit cf443a1

File tree

13 files changed

+37
-81
lines changed

13 files changed

+37
-81
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
-
6969
name: GitHub Release
7070
uses: softprops/action-gh-release@v1
71-
if: success() && startsWith(github.ref, 'refs/tags/')
71+
if: startsWith(github.ref, 'refs/tags/')
7272
with:
7373
draft: true
7474
files: |

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
pages_threshold: major_outage
6161
-
6262
name: Deploy
63-
if: success() && github.event_name != 'pull_request' && (endsWith(github.ref, github.event.repository.default_branch) || steps.prepare.outputs.release == 'true')
63+
if: github.event_name != 'pull_request' && (endsWith(github.ref, github.event.repository.default_branch) || steps.prepare.outputs.release == 'true')
6464
uses: crazy-max/[email protected]
6565
with:
6666
target_branch: gh-pages

.github/workflows/test.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ name: test
33
on:
44
push:
55
branches:
6-
- 'master'
7-
- 'v*'
6+
- '**'
87
paths-ignore:
98
- '**.md'
109
pull_request:

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## 7.1.1 (2020/11/02)
4+
5+
* Use embedded tzdata package
6+
* Remove `--timezone` flag
7+
* Docker image also available on [GitHub Container Registry](https://github.com/users/crazy-max/packages/container/package/ftpgrab)
8+
* Use Docker meta action to handle tags and labels
9+
310
## 7.1.0 (2020/10/04)
411

512
* Allow to disable `OPTS UTF8 ON` command

Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,9 @@ LABEL maintainer="CrazyMax"
3333
RUN apk --update --no-cache add \
3434
ca-certificates \
3535
libressl \
36-
tzdata \
3736
&& rm -rf /tmp/* /var/cache/apk/*
3837

3938
COPY --from=builder /app/ftpgrab /usr/local/bin/ftpgrab
40-
COPY --from=builder /usr/local/go/lib/time/zoneinfo.zip /usr/local/go/lib/time/zoneinfo.zip
4139
RUN ftpgrab --version
4240

4341
ENV FTPGRAB_DB_PATH="/db/ftpgrab.db" \

cmd/main.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"runtime"
88
"strings"
99
"syscall"
10-
"time"
10+
_ "time/tzdata"
1111

1212
"github.com/alecthomas/kong"
1313
"github.com/crazy-max/ftpgrab/v7/internal/app"
@@ -53,14 +53,8 @@ func main() {
5353
Summary: true,
5454
}))
5555

56-
// Load timezone location
57-
location, err := time.LoadLocation(cli.Timezone)
58-
if err != nil {
59-
log.Panic().Err(err).Msgf("Cannot load timezone %s", cli.Timezone)
60-
}
61-
6256
// Init
63-
logging.Configure(cli, location)
57+
logging.Configure(cli)
6458
log.Info().Str("version", version).Msgf("Starting %s", meta.Name)
6559

6660
// Handle os signals
@@ -81,7 +75,7 @@ func main() {
8175
log.Debug().Msg(cfg.String())
8276

8377
// Init
84-
if ftpgrab, err = app.New(cfg, location); err != nil {
78+
if ftpgrab, err = app.New(cfg); err != nil {
8579
log.Fatal().Err(err).Msgf("Cannot initialize %s", meta.Name)
8680
}
8781

docs/faq.md

Lines changed: 19 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
# FAQ
22

3-
## How to grab from multiple sources?
3+
## Timezone
44

5-
You can add multiple sources in the `sources` field of the configuration file:
5+
By default, all interpretation and scheduling is done with your local timezone (`TZ` environment variable).
66

7-
```yaml
8-
ftp|sftp:
9-
...
10-
sources:
11-
- /path1
12-
- /path2/folder
7+
Cron schedule may also override the timezone to be interpreted in by providing an additional space-separated field
8+
at the beginning of the cron spec, of the form `CRON_TZ=<timezone>`:
9+
10+
```shell
11+
$ ftpgrab --schedule "CRON_TZ=Asia/Tokyo */30 * * * *"
1312
```
1413

1514
## What kind of CRON expression can I use for scheduling?
@@ -21,59 +20,25 @@ A CRON expression represents a set of times, using 6 space-separated fields.
2120

2221
More examples can be found on the [official library documentation](https://godoc.org/github.com/robfig/cron#hdr-CRON_Expression_Format).
2322

23+
## How to grab from multiple sources?
24+
25+
You can add multiple sources in the `sources` field of the configuration file:
26+
27+
```yaml
28+
ftp|sftp:
29+
...
30+
sources:
31+
- /path1
32+
- /path2/folder
33+
```
34+
2435
## What Regexp semantic is used to filter inclusions/exclusions?
2536
2637
FTPGrab uses [Compile](https://golang.org/pkg/regexp/#Compile) to parse regular expressions. This means the regexp
2738
returns a match that begins as early as possible in the input (leftmost) like Perl, Python, and other implementations
2839
use. You can test your regular expression on [regex101.com](https://regex101.com/) and select Golang
2940
flavor. Check this [quick example](https://regex101.com/r/jITi0D/1).
3041
31-
## What logs look like?
32-
33-
Here is a sample output:
34-
35-
```text
36-
Tue, 29 Jan 2019 22:23:58 CET INF Starting FTPGrab 5.0.0
37-
Tue, 29 Jan 2019 22:23:58 CET INF ########
38-
Tue, 29 Jan 2019 22:23:58 CET INF Connecting to 198.51.100.0:21...
39-
Tue, 29 Jan 2019 22:23:58 CET INF Grabbing from /complete/
40-
Tue, 29 Jan 2019 22:23:59 CET INF --------
41-
Tue, 29 Jan 2019 22:23:59 CET INF Checking /complete/Burn.Notice.S06E16.VOSTFR.HDTV.XviD.avi
42-
Tue, 29 Jan 2019 22:23:59 CET INF Never downloaded
43-
Tue, 29 Jan 2019 22:23:59 CET INF Downloading file (184.18MB) to /tmp/seedbox/Burn.Notice.S06E16.VOSTFR.HDTV.XviD.avi...
44-
Tue, 29 Jan 2019 22:24:47 CET INF File successfully downloaded!
45-
Tue, 29 Jan 2019 22:24:47 CET INF Time spent: 48 seconds
46-
Tue, 29 Jan 2019 22:24:47 CET INF --------
47-
Tue, 29 Jan 2019 22:24:47 CET INF Checking /complete/Burn.Notice.S06E17.VOSTFR.HDTV.XviD.avi
48-
Tue, 29 Jan 2019 22:24:47 CET INF Never downloaded
49-
Tue, 29 Jan 2019 22:24:47 CET INF Downloading file (186.27MB) to /tmp/seedbox/Burn.Notice.S06E17.VOSTFR.HDTV.XviD.avi...
50-
Tue, 29 Jan 2019 22:25:40 CET INF File successfully downloaded!
51-
Tue, 29 Jan 2019 22:25:40 CET INF Time spent: 50 seconds
52-
Tue, 29 Jan 2019 22:25:40 CET INF --------
53-
Tue, 29 Jan 2019 22:25:40 CET INF Checking /complete/test_special_chars/123.bin
54-
Tue, 29 Jan 2019 22:25:40 CET INF Never downloaded
55-
Tue, 29 Jan 2019 22:25:40 CET INF Downloading file (33.27kB) to /tmp/seedbox/test/test_special_chars/123.bin...
56-
Tue, 29 Jan 2019 22:25:42 CET ERR Error downloading, retry 1/3 error="dial tcp 198.51.100.0:21: connect: connection refused"
57-
Tue, 29 Jan 2019 22:25:42 CET INF --------
58-
Tue, 29 Jan 2019 22:25:42 CET INF Checking /complete/test_special_chars/123.bin
59-
Tue, 29 Jan 2019 22:25:42 CET INF Exists but size is different
60-
Tue, 29 Jan 2019 22:25:42 CET INF Downloading file (33.27kB) to /tmp/seedbox/test/test_special_chars/123.bin...
61-
Tue, 29 Jan 2019 22:25:44 CET ERR Error downloading, retry 2/3 error="dial tcp 198.51.100.0:21: connect: connection refused"
62-
Tue, 29 Jan 2019 22:25:44 CET INF --------
63-
Tue, 29 Jan 2019 22:25:44 CET INF Checking /complete/test_special_chars/123.bin
64-
Tue, 29 Jan 2019 22:25:44 CET INF Exists but size is different
65-
Tue, 29 Jan 2019 22:25:44 CET INF Downloading file (33.27kB) to /tmp/seedbox/test/test_special_chars/123.bin...
66-
Tue, 29 Jan 2019 22:25:46 CET ERR Error downloading, retry 3/3 error="dial tcp 198.51.100.0:21: connect: connection refused"
67-
Tue, 29 Jan 2019 22:25:46 CET ERR Cannot download file error="dial tcp 198.51.100.0:21: connect: connection refused"
68-
Tue, 29 Jan 2019 22:25:46 CET INF Time spent: 6 seconds
69-
Tue, 29 Jan 2019 22:25:46 CET INF --------
70-
Tue, 29 Jan 2019 22:25:46 CET INF Checking /complete/exlcuded_file.txt
71-
Tue, 29 Jan 2019 22:25:46 CET INF Not included
72-
Tue, 29 Jan 2019 22:25:46 CET WRN Skipped: Not included
73-
Tue, 29 Jan 2019 22:25:46 CET INF ########
74-
Tue, 29 Jan 2019 22:25:51 CET INF Finished, total time spent: 1 minute 56 seconds
75-
```
76-
7742
## How can I edit/remove some entries in the database?
7843
7944
FTPGrab currently uses the embedded key/value database [bbolt](https://github.com/etcd-io/bbolt).

docs/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ periodically to your Synology, Qnap, D-Link and others NAS.
4242
* Webhook notification
4343
* Slack incoming webhook notification
4444
* Enhanced logging
45-
* Timezone can be changed
4645

4746
## License
4847

docs/install/linux-service.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ User=ftpgrab
2121
Group=ftpgrab
2222
ExecStart=/usr/local/bin/ftpgrab --config /etc/ftpgrab/ftpgrab.yml --schedule "*/30 * * * *" --log-level info
2323
Restart=always
24+
#Environment=TZ=Europe/Paris
2425
Environment=FTPGRAB_DB=/var/lib/ftpgrab/ftpgrab.db
2526
2627
[Install]

docs/usage/cli.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ Flags:
2020
--version
2121
--config=STRING FTPGrab configuration file ($CONFIG).
2222
--schedule=STRING CRON expression format ($SCHEDULE).
23-
--timezone="UTC" Timezone assigned to FTPGrab ($TZ).
2423
--log-level="info" Set log level ($LOG_LEVEL).
2524
--log-json Enable JSON logging output ($LOG_JSON).
2625
--log-file=STRING Add logging to a specific file ($LOG_FILE).
@@ -34,7 +33,6 @@ Following environment variables can be used in place:
3433
|--------------------|---------------|---------------|
3534
| `CONFIG` | | FTPGrab configuration file |
3635
| `SCHEDULE` | | [CRON expression](https://godoc.org/github.com/robfig/cron#hdr-CRON_Expression_Format) to schedule FTPGrab |
37-
| `TZ` | `UTC` | Timezone assigned |
3836
| `LOG_LEVEL` | `info` | Log level output |
3937
| `LOG_JSON` | `false` | Enable JSON logging output |
4038
| `LOG_FILE` | | Add logging to a specific file |

0 commit comments

Comments
 (0)