Comments (11)
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.
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.
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.
pallan, do you commented lines look the same (or similar) to br's above? If so I could regex them out.
from whenever.
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.
maybe a --cut # option to tell whenever how many lines to chop off the top?
from whenever.
Sounds good, I will see that I can do.
from whenever.
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.
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.
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.
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)
- Support for every other hour with offset (1am, 3am, etc.) HOT 3
- Operation not permitted - getcwd (Errno::EPERM) HOT 4
- How to set the daily time as the time of a certain time zone, thank you HOT 1
- How to change the shell by default (bash) ? HOT 1
- How do I "namespace" the crontab entries?
- ActionView::Template::Error (undefined method `>' for nil:NilClass): HOT 1
- Ruby 3.2 autocompletion in console HOT 9
- We need to move from travis-ci to github actions
- How to execute multiple tasks with a single runner ? HOT 1
- whenever command is not working HOT 1
- [Feature Request] Add Dashboard for whenever cron job activity monitoring
- Bundler::RubyVersionMismatch HOT 1
- whenever -w throws incompatible library error HOT 1
- [Feature Request] Pass job frequency as argument to job
- CRON cannot access my database? Could not find table. HOT 1
- Bug: version conflict when running `bundle exec rake test`
- Crontab doesn't work with Rails 7 HOT 2
- Cron jobs inside a docker container HOT 6
- Output redirection to STDOUT
- Bundler: failed to load command: whenever HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from whenever.