Saturday, May 18, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 3701  / 3 Years ago, fri, july 9, 2021, 4:05:51

EDITED:


I got a script running with a cronjob every day at 1 am:


0 1 * * * /bin/bash /home/performanceRatio.sh

It also appears in the cron.log:


Feb  2 01:00:01 inf-education-67 CRON[108963]: (root) CMD (bash performanceRatio.sh)
Feb 2 01:00:01 inf-education-67 CRON[108962]: (CRON) info (No MTA installed, discarding output)

Expected behavior is to update a mysql database. Changes appear if it's run manually.


Using Ubuntu 20.04


My script looks like:


#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin

python3 get_weather_data_crn.py && python3 pv.py

* * * * * env > /tmp/env.output shows:


HOME=/root
LOGNAME=root
PATH=/usr/bin:/bin
LANG=de_DE.UTF-8
SHELL=/bin/sh
PWD=/root

More From » cron

 Answers
4

Well, maybe it was a combination of the edits I already made (also in my post). But the final solution to get it all working was this:


#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin

python3 /home/get_weather_data_crn.py &&
python3 /home/pv.py

Yes, not making a NEWLINE! after && prevented Crontab to run the python scripts.


[#1993] Saturday, July 10, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
cheeturage

Total Points: 432
Total Questions: 111
Total Answers: 115

Location: Bahrain
Member since Tue, Mar 1, 2022
2 Years ago
cheeturage questions
Sat, Dec 4, 21, 02:22, 3 Years ago
Mon, Jan 2, 23, 22:39, 1 Year ago
Sun, Sep 12, 21, 03:21, 3 Years ago
;