Я использую xubuntu 18.01
У меня есть программа на python, которая очищает данные о погоде и сохраняет файлы в формате csv.Он отлично работает, запустив команду weatherdata
в терминале после того, как я дал ему разрешение, используя chmod +x weatherdata
.
. Я бы хотел запускать его каждые 2 недели, используя cron.Но ничего не происходит после того, как я его настроил.
Я использую редактор cron NANO
Я установил cronjob, пытаясь использовать переменные PATH, SHELL = / bin / bash /.P Помещение / bin / bash перед командой ... все безрезультатно ...
# crontab -e
SHELL=/bin/bash
MAILTO= mygmail@gmail.com (removed my actual email for privacy)
PATH=/home/luke/bin/
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command
34 * * * * /bin/bash /home/luke/bin/weatherdata
Я ожидал, что файл weatherdata
python будет выполняться каждый час через 34 минуты послечас.
Ничего не происходит, я не получаю электронное письмо или что-то еще.
Редактировать:
Я перешел на
SHELL=/bin/bash
#MAILTO=mygmail@gmail.com (commented it out)
PATH=/home/luke/bin/:/usr/sbin:/usr/bin:/sbin:/bin
что я получаю после запуска: 15 * * * * /bin/bash /home/luke/bin/weatherdata > /tmp/weatherlog 2>&1
, как предлагается в комментариях.
Traceback (most recent call last):
File "/home/luke/Documents/Duka/Master_River_Levels_LOOP.py", line 9, in <module>
import pandas as pd
ImportError: No module named pandas
Traceback (most recent call last):
File "/home/luke/Documents/Duka/Temp_Mean_Weather_loop.py", line 9, in <module>
import pandas as pd
ImportError: No module named pandas
Мне нужно импортировать несколько модулей для запуска скрипта python, первый из которых - panadas.