package com.hubspot.singularity.executor;

import com.google.common.base.Optional;

public enum SingularityExecutorLogrotateFrequency {
    HOURLY("hourly", Optional.of("0 * * * *")),
    DAILY("daily", Optional.<String>absent()),
    WEEKLY("weekly", Optional.<String>absent()),
    MONTHLY("monthly", Optional.<String>absent());

    private final String logrotateValue;
    private final Optional<String> cronSchedule;

    SingularityExecutorLogrotateFrequency(String logrotateValue, Optional<String> cronSchedule) {
        this.logrotateValue = logrotateValue;
        this.cronSchedule = cronSchedule;
    }

    public String getLogrotateValue() {
        return logrotateValue;
    }

    public Optional<String> getCronSchedule() {
        return cronSchedule;
    }
}


@@ -145,12 +145,11 @@
 LY(%22
-hour
+dai
 ly%22,
@@ -175,16 +175,112 @@
  * *%22)),
+  // we have to use the %22daily%22 frequency because not all versions of logrotate support %22hourly%22
 %0A    DAI

fix bug with not all logrotates understanding hourly