watchme: Can't find crontab at /usr/bin/crontab

Expected Behavior

Scheduling a watcher with watchme schedule watcher @daily should schedule the watcher.

Actual Behavior

Instead, it complains that it can’t find /usr/bin/crontab.

Traceback (most recent call last):
  File "/usr/local/bin/watchme", line 11, in <module>
    load_entry_point('watchme==0.0.26', 'console_scripts', 'watchme')()
  File "/usr/local/lib/python3.7/site-packages/watchme/client/__init__.py", line 346, in main
    main(args, extras)
  File "/usr/local/lib/python3.7/site-packages/watchme/client/schedule.py", line 44, in main
    watcher.schedule(minute, hour, month, day, weekday, force=args.force)
  File "/usr/local/lib/python3.7/site-packages/watchme/watchers/schedule.py", line 132, in schedule
    cron = self.get_crontab()
  File "/usr/local/lib/python3.7/site-packages/watchme/watchers/schedule.py", line 68, in get_crontab
    return CronTab(user=True)
  File "/usr/local/lib/python3.7/site-packages/crontab.py", line 227, in __init__
    self.read(tabfile)
  File "/usr/local/lib/python3.7/site-packages/crontab.py", line 284, in read
    (out, err) = open_pipe(CRONCMD, l='', **self.user_opt).communicate()
  File "/usr/local/lib/python3.7/site-packages/crontab.py", line 189, in open_pipe
    return sp.Popen(args, stdout=sp.PIPE, stderr=sp.PIPE, env=env)
  File "/usr/lib64/python3.7/subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "/usr/lib64/python3.7/subprocess.py", line 1522, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/crontab': '/usr/bin/crontab'

Steps to Reproduce

I followed all the steps on the Getting Started guide

sudo pip3 install watchme

watchme init

watchme create nicoli

watchme add-task nicoli task-singularity-release url@https://www.nicolishop.com/es/es/coleccion-ropa-para-hombres

watchme activate nicoli

watchme run nicoli

Output:

[1/1] |===================================| 100.0% 
ERROR Error running task.

watchme schedule nicoli @daily

Output: (shown under Actual behaviour)

Context

  • Operating System: Bedrock Linux

This is a Linux distribution that allows different programs / packages on the same system to be provided by different Linux distributions).

In this case, watchme is provided by Fedora (because I installed it with pip3, which is provided by Fedora), while crontab is provided by Debian. I will investigate if the issue is caused by Bedrock

  • watchme version: 0.0.26
  • python version: python 3.7.3

Failure Logs

[ log or files here. If relevant, include a screenshot]

Possible Fix

Sometimes Bedrock exhibits these types of problems where one program tries to access another program in a hardcoded location (eg. /usr/bin), when it’s actually in eg. /bedrock/cross/bin. However, as far as I can tell (looking at ls -l and file output, /usr/bin/crontab is actually there.

I will investigate if installing crontab from Fedora fixes the problem.

I also noticed that a package by the same name crontab exists in the python repositories and can be installed using pip. I installed it with sudo pip3 install crontab and I get a different error message now.

Traceback (most recent call last):
  File "/usr/local/bin/watchme", line 11, in <module>
    load_entry_point('watchme==0.0.26', 'console_scripts', 'watchme')()
  File "/usr/local/lib/python3.7/site-packages/watchme/client/__init__.py", line 346, in main
    main(args, extras)
  File "/usr/local/lib/python3.7/site-packages/watchme/client/schedule.py", line 44, in main
    watcher.schedule(minute, hour, month, day, weekday, force=args.force)
  File "/usr/local/lib/python3.7/site-packages/watchme/watchers/schedule.py", line 132, in schedule
    cron = self.get_crontab()
  File "/usr/local/lib/python3.7/site-packages/watchme/watchers/schedule.py", line 68, in get_crontab
    return CronTab(user=True)
TypeError: __init__() got an unexpected keyword argument 'user'

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 25 (13 by maintainers)

Most upvoted comments

I use Bedrock because I got tired of dealing with the inconsistencies between Linux distributions. I wanted to benefit from Arch Linux’s user repository, while at the same time be able to use a graphical installer to install the distribution. Also, for example the FAI project is convenient for installing Linux with very little fuss, but it only supports Debian. With Bedrock I don’t have to commit to using Debian instead of Arch, I can use both!