Skip to content

Commit c117b56

Browse files
committed
removed the -e flag
1 parent dec0088 commit c117b56

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

CHANGELOG

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
1.1.0
22
-----
33

4+
* remove the -e flag (use the MAILTO environment variable instead)
45
* added support for MAILTO as the preferred way to configure croncape
56
* disabled the timeout by default
67
* added a way to disable the timeout
7-
* removed the -c flag
8+
* removed the -c flag (pass the command directly)
89
* fixed environment variables handling
910

1011
1.0.0

README.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ That's it!
3434
Note that the `MAILTO` environment variable can also be defined globally in
3535
`/etc/crontab`; it supports multiple recipients by separating them with a comma.
3636

37-
Alternatively, you can also the `-e` flag to define emails:
38-
39-
0 6 * * * croncape -e "[email protected]" ls -lsa
40-
0 6 * * * croncape -e "[email protected],[email protected]" ls -lsa
41-
4237
Besides sending emails, croncape can also kill the run command after a given
4338
timeout, via the `-t` flag (disabled by default):
4439

@@ -59,7 +54,8 @@ Croncape is very similar to [cronwrap][2], with some differences:
5954
* Tries to use `sendmail` or `mail` depending on availability (cronwrap only
6055
works with `sendmail`);
6156

62-
* Reads the email from the standard crontab `MAILTO` environment variable.
57+
* Reads the email from the standard crontab `MAILTO` environment variable
58+
instead of a `-e` flag.
6359

6460
For a simpler alternative, have a look at [cronic][3].
6561

main.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ func main() {
3939
log.Fatalln(err)
4040
}
4141

42-
req := request{}
42+
req := request{
43+
emails: os.Getenv("MAILTO"),
44+
}
4345

44-
flag.StringVar(&req.emails, "e", "", `Emails to send reports when the command fails or exceeds timeout, like '-e "[email protected],[email protected]"'`)
4546
flag.DurationVar(&req.timeout, "t", 0, `Timeout for the command, like "-t 2h", "-t 2m", or "-t 30s". After the timeout, the command is killed, disabled by default`)
4647
flag.StringVar(&req.transport, "p", "auto", `Transport to use, like "-p auto", "-p mail", "-p sendmail"`)
4748
flag.BoolVar(&req.verbose, "v", false, "Enable sending emails even if command is successful")
@@ -53,10 +54,6 @@ func main() {
5354
os.Exit(1)
5455
}
5556

56-
if req.emails == "" && os.Getenv("MAILTO") != "" {
57-
req.emails = os.Getenv("MAILTO")
58-
}
59-
6057
r := execCmd(wd, req)
6158

6259
if r.killed || r.code != 0 || r.request.verbose {

0 commit comments

Comments
 (0)