doist / cronwrap Goto Github PK
View Code? Open in Web Editor NEWA cron job wrapper that wraps jobs and enables better error reproting and command timeouts.
Home Page: http://pypi.python.org/pypi/cronwrap
A cron job wrapper that wraps jobs and enables better error reproting and command timeouts.
Home Page: http://pypi.python.org/pypi/cronwrap
The time used in the cronwrap email is UTC. My time-zone is UTC+12 and now +13 because of daylight savings.
It is confusing and error-prone having to derive the local time from UTC. So I suggest to use the local time instead of the UTC time when adding the time to the email.
I don't see a button to attach a patch, so I included it as text below.
/usr/local/bin# diff cronwrap cronwrap2
123c123
< result_str.append('%s UTC\n' % (datetime.utcnow() - timedelta(seconds=int(cmd.run_time))))
---
> result_str.append('%s\n' % (datetime.now() - timedelta(seconds=int(cmd.run_time))))
126c126
< result_str.append('%s UTC\n' % datetime.utcnow())
---
> result_str.append('%s\n' % datetime.now())
I remember using this earlier and thought I would use it again, but it requires Python 2 due to its print
statements not using parenthesis. Would you consider releasing a new version that is runnable on non-deprecated versions of Python?
I could of course update the script and submit a PR.
Edit: turns out someone already did the work.
Hi,
I have started using cronwrap a couple of months ago and really liked it. I wanted to have more freedom with the from address of the emails I send out, so I began modifying it a bit. I added additional command line parameters for this and also allowed killing of commands that exceeded their deadline. At that point, this was still supposed to be a pull request.
I then ran into some issues with that because mail
doesn't work with the same parameters on all my systems. I hadn't thought of that when I started out. I subsequently switched the mail backend over to the email / smtp library that comes with Python. From there, I realized re-integration with cronwrap would be difficult. I have thus re-branded the project to croncoat and shared it again under the same BSD license. I hope this is fine with everyone here and in line with the open source spirit.
I am also writing here to request some help with the attribution. I could only find "2010 by Plurk" in the script files. Please reply here and/or contact me if you want your name added to a license file. If you consider the differences I list in the readme unfair or if you find bugs, let me know as well.
Kind regards,
Matthias Kauer
[edit] I suppose the code that kills commands after they timed out could be re-integrated with cronwrap if anyone is interested in that.
If I'm reading the code right, timeout is implemented by waiting for the command to complete (as os.system
blocks), and only then sending a mail about the timeout.
This doesn't really handle stalled processes right, does it?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.