Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/__pycache__/crontab.cpython-39.pyc
Ðазад
a n�h� � @ s\ d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddlmZ ddl mZmZm Z mZ ddlmZ dZdZe�d�Ze�d �Zd Zg d�Zg d�Zd dddddddd�ZddgZdddd�dddd�dddd�ddded �d!dd"ed �gZe�� d#kZejd$kZ e �o0e�!� d d%v Z"e �oZe�!� d d%v �pZe�!� d& d'v Z"d(Z#e�$d)�Z%d*Z&ej'�(d+d,�Z)d-d.� Z*e�s�ddl+Z+d/d0� Z*d1d2� Z,d3d4� Z-G d5d6� d6�Z.G d7d8� d8�Z/G d9d:� d:�Z0G d;d<� d<e1�Z2G d=d>� d>e3�Z4G d?d@� d@�Z5G dAdB� dB�Z6dCdD� Z7G dEdF� dF�Z8dPdHdI�Z9dQdJdK�Z:G dLdM� dM�Z;G dNdO� dOe�Z<dS )Ra from crontab import CronTab import sys # Create a new non-installed crontab cron = CronTab(tab='') job = cron.new(command='/usr/bin/echo') job.minute.during(5,50).every(5) job.hour.every(4) job.dow.on('SUN') job.month.during('APR', 'JUN') job.month.also.during('OCT', 'DEC') job.every(2).days() job.setall(1, 12, None, None, None) job2 = cron.new(command='/foo/bar', comment='SomeID') job2.every_reboot() jobs = list(cron.find_command('bar')) job3 = jobs[0] job3.clear() job3.minute.every(1) sys.stdout.write(str(cron.render())) job3.enable(False) for job4 in cron.find_command('echo'): sys.stdout.write(job4) for job5 in cron.find_comment('SomeID'): sys.stdout.write(job5) for job6 in cron: sys.stdout.write(job6) for job7 in cron: job7.every(3).hours() sys.stdout.write(job7) job7.every().dow() cron.remove_all(command='/foo/bar') cron.remove_all(comment='This command') cron.remove_all(time='* * * * *') cron.remove_all() output = cron.render() cron.write() cron.write(filename='/tmp/output.txt') #cron.write_to_user(user=True) #cron.write_to_user(user='root') # Croniter Extentions allow you to ask for the scheduled job times, make # sure you have croniter installed, it's not a hard dependancy. job3.schedule().get_next() job3.schedule().get_prev() � N)�sleep)�time�date�datetime� timedelta)�OrderedDictzpython-crontabz2.7.1za^\s*([^@#\s]+)\s+([^@#\s]+)\s+([^@#\s]+)\s+([^@#\s]+)\s+([^@#\s]+)\s+([^\n]*?)(\s+#\s*([^\n]*)|$)z(^\s*@(\w+)\s([^#\n]*)(\s+#\s*([^\n]*)|$)z>/dev/null 2>&1)�sun�mon�tue�wed�thu�fri�satr ) N�jan�feb�mar�apr�may�jun�jul�aug�sep�oct�nov�dec�@rebootz 0 * * * *z 0 0 * * *z 0 0 * * 0z 0 0 1 * *z 0 0 1 1 *)ZrebootZhourlyZdailyZweeklyZmonthlyZyearly�annually�midnightr r �; ZMinutes)�max�min�name� ZHours� � zDay of Month� ZMonth)r r r! �enum� zDay of Week�Windows�posix)�SunOSZAIXzHP-UX� )�mipsFZcrontabz/usr/bin/crontab�SHELLz/bin/shc C s d S �N� r/ r/ r/ �w/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/crontab.py�<lambda>� � r1 c C s t �t�� �d S )z(Returns the username of the current userr )�pwd�getpwuid�os�getuidr/ r/ r/ r0 �current_user� s r7 c O s� t tj| |�dt�d��}|�dd�}|�� D ]L\}}t|�dkrh|d| f7 }|durz|t|�f7 }q.|d||f f7 }q.t dd � |t |� D ��}tj |tj tj |d �S )z�Runs a program and orders the arguments for compatability. a. keyword args are flags and always appear /before/ arguments for bsd r) )r) �envNr$ z-%sz--%s=%sc s s | ]}|r|V qd S r. r/ )�.0�argr/ r/ r0 � <genexpr>� r2 zopen_pipe.<locals>.<genexpr>)�stdout�stderrr8 )�tuple�shlex�split�pop�POSIX�items�len�str�sp�Popen�PIPE)�cmd�args�flags�cmd_argsr8 �key�valuer/ r/ r0 � open_pipe� s rO c C s t | t�r| �d�S | S )z9Convert to the best string format for this python version�utf-8)� isinstance�bytes�decode��textr/ r/ r0 �_str� s rV c s e Zd ZdZd?dd�Zdd� Zdd� Zed d � �Zedd� �Z ed d� �Z � fdd�Zd@dd�ZdAdd�Z dBdd�ZdCdd�Zdd� ZdDdd �ZdEd!d"�ZdFd#d$�Zd%d&� Zd'd(� Zd)d*� Zed+d,� �Zed-d.� �Zd/d0� Zd1d2� Zd3d4� Zd5d6� Zd7d8� Zd9d:� Zd;d<� Zd=d>� Z � Z!S )G�CronTaban Crontab object which can access any time based cron using the standard. user - Set the user of the crontab (default: None) * 'user' = Load from $username's crontab (instead of tab or tabfile) * None = Don't load anything from any user crontab. * True = Load from current $USER's crontab (unix only) * False = This is a system crontab, each command has a username tab - Use a string variable as the crontab instead of installed crontab tabfile - Use a file for the crontab instead of installed crontab log - Filename for logfile instead of /var/log/syslog Nc C s` d | _ d | _d | _t| _d | _t� | _t o6t � � dk| _|| _|| _ || _| �|� || _d S )Nr )�lines�crons�filen�CRON_COMMAND�cron_commandr8 r �_parked_env�WINOSr5 r6 �root�_user�intab�tabfile�read�_log)�self�user�tabrb �logr/ r/ r0 �__init__� s zCronTab.__init__c C s | S r. r/ �re r/ r/ r0 � __enter__� s zCronTab.__enter__c C s | � � d S r. ��write)re �exc_type�exc_val�exc_tbr/ r/ r0 �__exit__� s zCronTab.__exit__c C s>