{ "info": { "author": "piglei", "author_email": "piglei2007@gmail.com", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3" ], "description": "========\npycronic\n========\n\n`Chinese Version`_\n\nThis project is inspired by `cronic`_ and includes some extra useful functions\nsuch as sending email error report through SMTP and store logs of crontab scripts.\n\nWhy pycronic?\n=============\n\nCrontab has the ability to send mail notification when any output was generated\nexecuting your script, as we know. It will send a bunch of emails to you \nevery day if you have a lof of scripts. What if we only want to get the mail \nwhen something goes wrong?\n\nAs a result, You may config your crontab like this: ::\n\n # Redirect all standard output to /dev/null so we will get an email\n # only if this script has some standard error output.\n * * * * * some_work > /dev/null\n\n # Or this to ignore all output for lazy people, but you will never \n # be notified if your script fails.\n * * * * * some_work > /dev/null 2>&1\n\nUsing pycronic make things simplier: ::\n\n cronic=\"/usr/local/bin/cronic\" \n * * * * * &cronic some_work\n\nAll you need is to prepend cronic to your script execution command.\n**cronic** command will check the return code and the error output for you, if something\nwents wrong, you will get an email notification through crontab's default mailing system\nor your customized STMP server. ::\n\n MAIL TITLE: [Cronic@server1] Error occoured when running \"backup\"\n\n MAIL CONTENT: \n\n Cronic Error Report\n ===================\n\n [2013-11-12 16:07:24.228788] Cronic detected failure or error output for the command:\n\n backup\n\n RESULT CODE: 2\n\n ERROR OUTPUT:\n ~~~~~~~~~~~~~\n\n Can not connect to database!\n\n STANDARD OUTPUT:\n ~~~~~~~~~~~~~~~~\n\n Starting backup...\n\nAnd cronic will store all your scripts output to a directory (/tmp/pycronic by default).\n\nInstallation\n============\n\nUsing pip: ::\n\n # Install from pypi\n sudo pip install pycronic\n # Latest version from git\n sudo pip install https://github.com/piglei/pycronic/archive/master.zip\n # Or install from github\n sudo pip install -e git+https://github.com/piglei/pycronic/#egg=pycronic\n\nNote: pycronic is now python3 compatible, you can install using ``pip3 install ...``\n\n\nConfiguration\n=============\n\nAfter the installation, run \"cronic\" in your command line to verify: ::\n\n $ cronic \n Usage: cronic YOUR_COMMAND\n\n $ cronic ls\n Config file \"/etc/pycronic.conf\" does not exist!\n Run \"cronic init\" to create a default one.\"\n\nThen run \"sudo cronic init\" to create a default config file under /etc, the default config\nfile should look like this: ::\n\n # Log path for pycronic, pycronic will store all logs to this directory\n log_path = /tmp/pycronic\n\n # Send an error email or not, default to not send\n send_alert_email = True\n\n # Email Title\n mail_title = [Cronic@%(host)s] Error occoured when running \"%(command)s\"\n\n # Email receivers\n # receivers = sample@sample.com\n\n # Email smtp server config\n [email_config_smtp]\n # username = username\n # host = smtp.sample.com\n # password = password\n # from = Cronic \n # port = 587\n\nHow to use\n==========\n\ncronic will be silent if no error occured when running a script: ::\n\n piglei@macbook-pro:etc$ cronic ls\n piglei@macbook-pro:etc$ cat /tmp/pycronic/ls.log \n [The script result will be stored in the log file]\n\nBut if an error has occured (cronic will check the standard error output), it will print\nan error message like this: ::\n\n $ cronic ls asdf\n Cronic Error Report\n ===================\n\n [2013-11-12 15:49:03.349575] Cronic detected failure or error output for the command:\n\n ls asdf\n\n RESULT CODE: 1\n\n ERROR OUTPUT: \n ~~~~~~~~~~~~~\n\n ls: asdf: No such file or directory\n\n STANDARD OUTPUT:\n ~~~~~~~~~~~~~~~~\n\n None\n\nIf you have configured your crontab an email will send to your email address.\n\nYou can also modify config to send mail through SMTP instead of using crontab \nwhich is highly more recommended.\n\nRock crontab\n============\n\nNow config your crontab, using pycronic to wrap your scripts: ::\n\n\n $ crontab -e\n # If you have not config your pycronic.conf's smtp config, you can still\n # use crontab to send error emails.\n MAILTO=\"piglei2007@gmail.com\"\n cronic=\"/usr/local/bin/cronic\" \n\n */5 * * * * $cronic YOUR SCRIPT\n\nEnjoy!\n\n.. _cronic: http://habilis.net/cronic/\n.. _Chinese Version: https://github.com/piglei/pycronic/blob/master/README_zh.rst\n\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/piglei/pycronic/", "keywords": "crontab cronic", "license": "GPL", "maintainer": "", "maintainer_email": "", "name": "pycronic", "package_url": "https://pypi.org/project/pycronic/", "platform": "", "project_url": "https://pypi.org/project/pycronic/", "project_urls": { "Homepage": "https://github.com/piglei/pycronic/" }, "release_url": "https://pypi.org/project/pycronic/0.0.5/", "requires_dist": [ "configobj", "sender" ], "requires_python": "", "summary": "A crontab script wrapper written by python", "version": "0.0.5" }, "last_serial": 4498567, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "fe62cfa9b6d77d17eaf04e980e9febf3", "sha256": "0246674b6b647e3e9cbe84222082854a64dd379c9b03f15e91ac15216c57a1eb" }, "downloads": -1, "filename": "pycronic-0.0.1.tar.gz", "has_sig": false, "md5_digest": "fe62cfa9b6d77d17eaf04e980e9febf3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3992, "upload_time": "2013-11-12T10:09:18", "url": "https://files.pythonhosted.org/packages/3c/ce/3f631af943b9c76b500666d452f3610a67a6d6a0cdc2910ec22c0139dd14/pycronic-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "0e46291913dffd4e58c9cae0233c0a80", "sha256": "a22e4b06eb93608b726cc5872effd1f14bf9bae7d254c808989634c6fc00a28d" }, "downloads": -1, "filename": "pycronic-0.0.2.tar.gz", "has_sig": false, "md5_digest": "0e46291913dffd4e58c9cae0233c0a80", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4099, "upload_time": "2013-11-12T14:26:48", "url": "https://files.pythonhosted.org/packages/95/bb/3e6bcd6a7fab65a586fab0b0ac8caa16b9d56fd3a9534ca83b6c9e358c96/pycronic-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "871b86cd997d2f1b2e7ba6954d624e82", "sha256": "0c45b9750603faa235d80e1038ed87c5d52b9f0cba48185d04099f489d9812e3" }, "downloads": -1, "filename": "pycronic-0.0.3.tar.gz", "has_sig": false, "md5_digest": "871b86cd997d2f1b2e7ba6954d624e82", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4904, "upload_time": "2017-01-16T14:02:19", "url": "https://files.pythonhosted.org/packages/1e/cd/9a78a05cc8f23cd4949d6147b5dbb43089f6dd55a329a77f78143396889d/pycronic-0.0.3.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "c98c8523b5cc27817faa7d2a7640814f", "sha256": "88757ff3aa34abd53a3d8f0ee0fdfdb7d1b829b8be9656aa1f24e5859e6fb37c" }, "downloads": -1, "filename": "pycronic-0.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "c98c8523b5cc27817faa7d2a7640814f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 12512, "upload_time": "2018-11-17T23:57:30", "url": "https://files.pythonhosted.org/packages/52/ed/d4e527652e91aa1c2855f3367d3bd9b7b863251170317b89ec4336e50467/pycronic-0.0.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c723aeaad232611bf94b4d6e8fd285b9", "sha256": "a4e274b42714d248b79f8ef652a7817c39c731f03dd2435a8f9e62a2c51b65a8" }, "downloads": -1, "filename": "pycronic-0.0.5.tar.gz", "has_sig": false, "md5_digest": "c723aeaad232611bf94b4d6e8fd285b9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5010, "upload_time": "2018-11-17T23:57:31", "url": "https://files.pythonhosted.org/packages/48/8e/2ac849a0284af0cd05a73836fa76f4d1ce1f5457311ec7888efcd545258f/pycronic-0.0.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c98c8523b5cc27817faa7d2a7640814f", "sha256": "88757ff3aa34abd53a3d8f0ee0fdfdb7d1b829b8be9656aa1f24e5859e6fb37c" }, "downloads": -1, "filename": "pycronic-0.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "c98c8523b5cc27817faa7d2a7640814f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 12512, "upload_time": "2018-11-17T23:57:30", "url": "https://files.pythonhosted.org/packages/52/ed/d4e527652e91aa1c2855f3367d3bd9b7b863251170317b89ec4336e50467/pycronic-0.0.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c723aeaad232611bf94b4d6e8fd285b9", "sha256": "a4e274b42714d248b79f8ef652a7817c39c731f03dd2435a8f9e62a2c51b65a8" }, "downloads": -1, "filename": "pycronic-0.0.5.tar.gz", "has_sig": false, "md5_digest": "c723aeaad232611bf94b4d6e8fd285b9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5010, "upload_time": "2018-11-17T23:57:31", "url": "https://files.pythonhosted.org/packages/48/8e/2ac849a0284af0cd05a73836fa76f4d1ce1f5457311ec7888efcd545258f/pycronic-0.0.5.tar.gz" } ] }