cron

Scheduled python code can't find module when run in Docker

Scheduled python code can't find module when run in Docker Question: I’m trying to run a python script inside a Docker container every 2 minutes. To achieve this, I am using a cron job. When I run the Python script on the host machine, it executes perfectly, but inside the docker container I keep getting …

Total answers: 3

Selenium works only when I'm connected to a remote server

Selenium works only when I'm connected to a remote server Question: I am trying to run a simple Selenium chrome-driver test on a remote Ubuntu server (EC2). In order to run the code immediately after rebooting, I define the following crontab entry: @reboot export DISPLAY=:0 && export PATH=$PATH:/usr/local/bin && nohup /usr/bin/python3 /home/ubuntu/test/play/client.py 60 http://192.162.2.2:8080 & …

Total answers: 1

problem with cronjob to run python script on ubuntu server

problem with cronjob to run python script on ubuntu server Question: I have installed python3 following the Digital Ocean guide and to run my python scripts just by command line, this is the bash I use and it works: ~$ source /home/username/python_projects/project_name/bin/activate ~$ python3 /home/username/python_projects/project_name.py ~$ deactivate if I put that commands in crontab in …

Total answers: 2

Anacron will not run notifications from python/bash scripts

Anacron will not run notifications from python/bash scripts Question: The basics I am trying to add desktop notifications to some fairly simple scripts running with anacron just to let me know when they are running and when they have finished. For some reason, the scripts DO run, but the notifications never get sent. If I …

Total answers: 1

Python: Scheduling cron jobs with time limit?

Python: Scheduling cron jobs with time limit? Question: I have been using apscheduler. A recurring problem regarding the package is that if for any reason, a running job hangs indefinitely (for example if you create an infinite while loop inside of it) it will stop the whole process forever as there is no time limit …

Total answers: 1

How can I write something into crontab file from Python file?

How can I write something into crontab file from Python file? Question: I try to write from a Python file cronjobs into crontab. When calling the Python file which contains the code for writing into crontab from another Python file via sudo I expect that the cronjob gets added to the crontab file but instead …

Total answers: 1

Crontab spawning multiple instances of task instead of a single instance

Crontab spawning multiple instances of task instead of a single instance Question: I have a python script which needs to run every 5 minutes. I am calling this script via a bash file named activate.sh: #!/bin/bash ../../env/bin/python3 ./run.py Then to run this task every 5 minutes, I have a crontab job configured as such: */5 …

Total answers: 1

No module named certifi

No module named certifi Question: When executing python3 (Python 3.6.8) script on a local directory, it works well, but when running sbatch job in slurm, complains about certifi. python3 -m pip install certifi Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: certifi in /usr/local/lib/python3.6/site-packages (2020.12.5) After adding to the python …

Total answers: 4

Apscheduler run job every weekday on specific time range

Apscheduler run job every weekday on specific time range Question: I have a current apscheduler that runs the job mon-fri and an interval of ~4 mins all day long. Is it possible to run the job for a specific time range? Lets say from 9:00 am to 5:00 pm in this case? My expression looks …

Total answers: 2

Selenium with chromedriver doesn't start via cron

Selenium with chromedriver doesn't start via cron Question: Python script with Selenium and Chromedriver in headless mode on CentOS7 runs fine when called manually. options = webdriver.ChromeOptions() options.add_argument(‘headless’) options.add_argument(‘no-sandbox’) self.driver = webdriver.Chrome(chrome_options=options) When starting script with crontab however it throws this exception at line 4 (above). Full traceback at bottom. selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome …

Total answers: 4