python-crontab | Github mirror of python-crontab | Cron Utils library

 by   peak6 Python Version: Current License: LGPL-3.0

kandi X-RAY | python-crontab Summary

kandi X-RAY | python-crontab Summary

python-crontab is a Python library typically used in Utilities, Cron Utils applications. python-crontab has no bugs, it has no vulnerabilities, it has build file available, it has a Weak Copyleft License and it has low support. You can download it from GitHub.

Crontab module for read and writing crontab files and accessing the system cron automatically and simply using a direct API. Comparing the `below chart `_ you will note that W, L, # and ? symbols are not supported as they are not standard Linux or SystemV crontab format. ============= =========== ================= =================== ============= Field Name Mandatory Allowed Values Special Characters Extra Values ============= =========== ================= =================== ============= Minutes Yes 0-59 \* / , - < > Hours Yes 0-23 \* / , - < > Day of month Yes 1-31 \* / , - < > Month Yes 1-12 or JAN-DEC \* / , - < > Day of week Yes 0-6 or SUN-SAT \* / , - < > ============= =========== ================= =================== =============. Extra Values are '<' for minimum value, such as 0 for minutes or 1 for months. And '>' for maximum value, such as 23 for hours or 12 for months.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              python-crontab has a low active ecosystem.
              It has 23 star(s) with 7 fork(s). There are 6 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              python-crontab has no issues reported. There are 1 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of python-crontab is current.

            kandi-Quality Quality

              python-crontab has no bugs reported.

            kandi-Security Security

              python-crontab has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              python-crontab is licensed under the LGPL-3.0 License. This license is Weak Copyleft.
              Weak Copyleft licenses have some restrictions, but you can use them in commercial projects.

            kandi-Reuse Reuse

              python-crontab releases are not available. You will need to build from source code and install.
              Build file is available. You can build the component from source.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi has reviewed python-crontab and discovered the below as its top functions. This is intended to give you an instant insight into python-crontab implemented functionality, and help decide if they suit your requirements.
            • Parse a cron range string
            • Return a CronValue instance
            • Resets the range of values
            • Parse the value of the crontab
            • Read crontab file
            • Read lines from the file
            • Append a cron
            • Create a pipe with flags
            • Run the next run
            • Run the command
            • Schedules the current slice
            • Parse the value
            • Return a new CronRange
            • Return a list of comments
            • Returns whether this CronSlices is valid
            • Add new tabs
            • Return the log for this program
            • The authenticated user
            • Generate a crontab
            • Start time between two intervals
            • Return a list of crons
            • Return the user options
            • Parse parts
            • Parses a line
            • Create a new job
            • Return a list of CronTab objects
            Get all kandi verified functions for this library.

            python-crontab Key Features

            No Key Features are available at this moment for python-crontab.

            python-crontab Examples and Code Snippets

            No Code Snippets are available at this moment for python-crontab.

            Community Discussions

            QUESTION

            Cron redirect stdout and stderr to different files
            Asked 2021-Feb-02 at 14:08

            I'm using a python script with python-crontab to generate job entries in the crontab, and execute them every minute.

            I'm doing something like:

            ...

            ANSWER

            Answered 2021-Feb-02 at 14:08

            This way, I'm redirecting both the stdout and stderr to the log_listener.txt file. Is it possible to split them, and send them to two different files?

            Youre redirecting b oth to log_listener.txt because you specifically asked that stderr (2)'s output be redirected (>) to stdout (&1).

            If that's not what you want, don't do that?

            > f is a shortcut for 1>f which redirects output (>) from stdout (1) to the file f, truncating it if it exists.

            2 is stderr, so you can just 2> to some other file in order to redirect stderr to a different file than stdout. >> is an appending redirection so 2>> will append stderr to an existing file (or create it) in the same way >> does for stdin.

            Therefore you can just have a command of

            Source https://stackoverflow.com/questions/66011183

            QUESTION

            Airflow install problem SyntaxError: Missing parentheses in call to 'print'
            Asked 2020-Dec-01 at 14:26

            Im trying to install airflow on Ubuntu.

            I set up a virtualenv with python 3.5.3 and tried to install airflow this way :

            ...

            ANSWER

            Answered 2020-Dec-01 at 14:26

            Use the following i.e. https://github.com/apache/airflow/blob/constraints-1.10.9/constraints-3.5.txt (Constraints file for Airflow 1.10.9 and Python 3.5):

            Source https://stackoverflow.com/questions/65089903

            QUESTION

            python cronjob not deleted after remove_all
            Asked 2020-Nov-19 at 14:56

            TLDR: Using python, crontab.remove_all appears to be working, but when I instanciate a new crontab, I can see that the remove_all command didn't work.

            Long question : I'm trying to use cronjobs in my project, but before that I want to be able to test them. As I don't want to have an infinity of jobs running, I need to first be able to delete them. However, it doesn't work as I thought it would.

            Here is my code :

            ...

            ANSWER

            Answered 2020-Nov-19 at 14:43

            crontab just interacts with the system's cron management. If you don't write the changes, they're not commmitted, so instantiating a new crontab object will read the existing stuff, not the "pending" work.

            Source https://stackoverflow.com/questions/64913924

            QUESTION

            Multiple jobs using python-crontab
            Asked 2020-Aug-09 at 11:17

            I am using python-crontab to build a Desktop notification system. However, I can not figure out how to schedule multiple scripts using python-crontab.

            Here is what I have to schedule one script:

            ...

            ANSWER

            Answered 2020-Aug-09 at 11:17

            QUESTION

            python-crontab: find existing cron jobs is giving wrong result
            Asked 2020-Jul-15 at 01:52

            With my python script below, I wanted to check if a cron job is defined in my linux (centOS 7.5) server, and if it doesn't exist, I will add one by using python-crontab module.. It was working well until I gave CRONTAB -R to delete existing cron jobs and when I re-execute my python script, it is saying cronjob exists even after they were removed using crontab -r..

            ...

            ANSWER

            Answered 2020-Jul-15 at 01:50

            The problem is that you have initialized a new Cron job before checking if it exists. You assumed that Cron.find_command() is only identifying enabled cron jobs. But it also identifies cronjobs that are created, but not enabled yet.

            So, you have to check if the cronjob exists before creating a new job. Then, if it does not exist, you can create a new cron job and enable it. You can try the below code:

            Source https://stackoverflow.com/questions/62741775

            QUESTION

            HOW to fix 'PermissionError: [Errno 13] Permission denied' in python-crontab in docker image?
            Asked 2019-Jul-05 at 06:43

            I create a docker image in order to set a python code with schedule,so I use python-crontab module, how can i solve permission denied problem?

            Ubuntu 16.04.6 LTS python 3.5.2

            I create sche.py and it can trigger weather.py, it is success in local,but it can't package to docker image

            ...

            ANSWER

            Answered 2019-Jul-05 at 06:20

            Try USER root after FROM python:3.5.2 line.

            Remove CMD ["sudo"] and ENTRYPOINT ["/weather"]

            Updated

            Replace RUN mkdir /usr/bin/crontab

            Source https://stackoverflow.com/questions/56896929

            QUESTION

            Python crontab schedule job at certain hour
            Asked 2019-May-15 at 02:36

            I was reading python-crontab documentation and I could not find a way to schedule a job every day at a certain hour. I want to have something like this:

            ...

            ANSWER

            Answered 2019-May-14 at 20:52

            It sounds like what you want is 0 17 * * *, which will run everyday at 17:00.

            To achieve this you need to set the minute to 0:

            Source https://stackoverflow.com/questions/56137764

            QUESTION

            Error with celery worker in elastic beanstalk (using django and SQS) [ImportError: The curl client requires the pycurl library.]
            Asked 2019-Jan-30 at 12:33

            I'm trying to deploy to elastic beanstalk a django project that uses celery periodic tasks, using SQS.

            I've been more or less following the instructions here:

            How to run a celery worker with Django app scalable by AWS Elastic Beanstalk?

            When I deploy to eb, the periodic tasks are not being executed.

            Checking the celery-beat log, everything seems right:

            ...

            ANSWER

            Answered 2019-Jan-30 at 12:33

            QUESTION

            importing paramiko and mysql.connector packages not working when ran as cron job
            Asked 2019-Jan-03 at 11:58

            Importing packages that are subsequently installed (not present by default in python distribution for rhel 7.6) not working when ran as cron job

            Hi Team,

            I have a python(2.7) script which imports paramiko package. The script can import the paramiko package successfully when ran as a user(root or ftpuser) after logging in but it cannot import it when ran from cron job. I have tried out various options as provided in the brilliant stack overflow pages like the below but unfortunately couldn't resolve the issue. 1) Crontab not running my python script

            I have provided the path to the paramiko package and verified it is successfully received at the script end by logging it when run as cron job and also I have given chmod -R 777 permission to the paramiko folder in the /opt/rh/python27/root/usr/lib/python2.7/site-packages location. Still the import is not functioning when ran as cron job

            I have created a shell script and tried to invoke python script from with in the script and configured the shell script in cron job but it seems python script was not invoked

            I have verified that there is only one python installation present in the server and so I' am using the correct path

            I have disabled selinux option and tried after rebooting but issue still persists

            Please note the issue exists not for just paramiko package but for other packages as well that was installed subsequently like mysql.connector e t c

            Update1

            It has to be something to do with the way I install the paramiko package because the script can even import other packages in the same path as that of paramiko and the permissions for both of them look identical only difference is former comes with the python distribution that is deployed from using the url https://access.redhat.com/solutions/1519803. Cannot figure out what is wrong with the installation steps as I install it as root after doing sudo su and then setting umask to 0022. I do pip install of parmiko and python-crontab as mentioned in their sites and both have the same issue

            Another interesting thing is though I have the code to log exception around the failing import statement it never logs the exception but script seems to halt/hang at the import statment

            Please help to resolve this issue...

            PYTHON CODE ...

            ANSWER

            Answered 2019-Jan-03 at 11:58

            This seems to be working now after adding one more environment variable to crontab as below

            LD_LIBRARY_PATH=/opt/rh/python27/root/usr/lib64

            Source https://stackoverflow.com/questions/53910588

            QUESTION

            AttributeError: 'list' object has no attribute 'split' - Print next crontab scheduled job with croniter - stdout - Python
            Asked 2018-Dec-02 at 17:42

            I need to read the contents of the /etc/crontab file.

            Right now I have this:

            ...

            ANSWER

            Answered 2018-Dec-02 at 17:41

            croniter handles a single cron-expression. You should have it inside the loop, and apply it to each row individually:

            Source https://stackoverflow.com/questions/53582053

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install python-crontab

            You can download it from GitHub.
            You can use python-crontab like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.

            Support

            Support for vixie cron with username addition with user flag. Support for SunOS, AIX & HP with compatibility 'SystemV' mode. Python 3.4 and Python 2.7/2.6 tested. Windows support works for non-system crontabs only. ( see mem_cron and file_cron examples above for usage ).
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/peak6/python-crontab.git

          • CLI

            gh repo clone peak6/python-crontab

          • sshUrl

            git@github.com:peak6/python-crontab.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Cron Utils Libraries

            cron

            by robfig

            node-schedule

            by node-schedule

            agenda

            by agenda

            node-cron

            by kelektiv

            cron-expression

            by mtdowling

            Try Top Libraries by peak6

            scala-ssh-shell

            by peak6Scala

            Rocket.Chat.Audit

            by peak6Python

            elephaas

            by peak6Python

            github_enterprise

            by peak6Python

            go-mmd

            by peak6Go