Giter VIP home page Giter VIP logo

Comments (11)

javan avatar javan commented on June 15, 2024

Those comments definitely weren't written by Whenever. Whenever calls the unix command crontab to actually write the crontab file so perhaps it is to blame. If you find that there's a way to avoid this with the crontab command, let me know.

What OS are you running?

from whenever.

 avatar commented on June 15, 2024

Gentoo 4.1.2

I figured it was a cron thing, but was hoping you had seen it before. Google did not yield anything helpful as far as turning it off. We probably just need to fork and remove the first three lines of the file every time.

from whenever.

pallan avatar pallan commented on June 15, 2024

We are having the same issue and I think I figured out what is going on. To rebuild the crontab, whenever is performing and crontab -l command and then doing a replace on the contents. On our server, OpenSuse 11.2, crontab -l includes these comments at the top, but when you edit the crontab these comments do not appear in the editor. Cron must take the complete contents of the submitted crontab and insert the comments at the top when you save. Since whenever, unknowingly, keeps the comments in the crontab it submits and cron saves the file and appends newer comments on as usual.

from whenever.

javan avatar javan commented on June 15, 2024

pallan, do you commented lines look the same (or similar) to br's above? If so I could regex them out.

from whenever.

pallan avatar pallan commented on June 15, 2024

yes they do, i am looking at the code right now. I started to add an additional command line options, -C, to allow the user to tell whenever to strip them out. It appears to be distro specific so I didn't think a global replace was the best idea.

from whenever.

javan avatar javan commented on June 15, 2024

maybe a --cut # option to tell whenever how many lines to chop off the top?

from whenever.

pallan avatar pallan commented on June 15, 2024

Sounds good, I will see that I can do.

from whenever.

pallan avatar pallan commented on June 15, 2024

I added a commit to my fork, but don't have tests yet if you want to take a look http://github.com/pallan/whenever/commit/9157c270282a33de16140806b6d665bfac4bef15

from whenever.

pallan avatar pallan commented on June 15, 2024

Finally got a chance to get back and look at this, and having a heck of a time getting a test in place for it. Since the "cutting" of the crontab happens in the read_crontab method, and that method is usually mocked to stop the command line execution I can't get a clean test implemented. Any suggestions? Commit has moved here http://github.com/pallan/whenever/commit/29910fd6ba0d1e8e89797993b6b15e9c87682492

from whenever.

javan avatar javan commented on June 15, 2024

How about just a test or two for your #prepare method? Just make sure it cuts off lines from the top like you expect.

from whenever.

pallan avatar pallan commented on June 15, 2024

Did it. Always get ansy when adding a test that calls a protected/private method directly, but it made sense once you take into account how you initialize the command. I sent a pull request for you also. Thanks!

from whenever.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.