As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [cron]

the job scheduler in Linux and other Unix-like operating systems. It enables users to schedule tasks to run non-interactively at specified intervals or predefined times, including upon reboot.

Filter by
Sorted by
Tagged with
35 votes
2 answers
147k views

Open chromium full screen on start up

I would like to set up a couple of Raspberry Pis to open automatically chromium or any other browser available to at start-up, and in full screen mode. I was wondering if any of you can help me. ...
Catalin's user avatar
  • 367
22 votes
5 answers
65k views

How do I reboot at a specific time?

Is it possible to re-boot my Raspberry Pi at midnight each night? I know in Linux, you'd use crontab, but I can't seem to find /etc/crontab.
Phorce's user avatar
  • 613
20 votes
2 answers
49k views

Where do Cron error message go?

I have a python script running by cron. For what ever reason, it is not running. I am wondering if there is anywhere that error messages are sent? Script runs fine by itself. If I run a simple script ...
Richard's user avatar
  • 461
14 votes
1 answer
4k views

Automatic updating recommended?

Is it recommended to configure something to automatically keep an RPi updated? And if so, which method (cron-apt or something else)?
Cade Roux's user avatar
  • 2,067
8 votes
4 answers
8k views

Default shell for cron issue

I have some commands, they are working under bash, but not as cronjob. To see, what cause the problem, i'm saving the output in a file, here my example: 51 * * * * source ~/.rvm/scripts/rvm &...
cupakob's user avatar
  • 977
7 votes
1 answer
7k views

What's different about a crontab reboot?

I have a python script to log data from a USB weather station and present it via a flask front end. The USB on the pi (Pi2 model B) is flaky and occasionally hangs after 24-48 hours. The flask app ...
Steve Foster's user avatar
6 votes
5 answers
3k views

Is there a way to remove old files without relying on internet time service?

I have a Raspberry Pi that is acting as a sensor which I am sending out to various customers. The sensor is recording approximately 1 GB every 2-3 days, so I would like to have a way to remove old ...
Cameron Greenwalt's user avatar
5 votes
3 answers
7k views

Execute a script at sunrise/sunset

Good afternoon, I'm trying to edit by soft, as a text file, the file that contains the crontab data. This is because I need to execute a series of functions daily, they are related to the sunrise and ...
quito127's user avatar
5 votes
3 answers
1k views

Is it necessary to release Raspberry Pi Camera before rebooting? If so how do I do it?

I have a python3 script that uses OpenCV and a Raspberry Pi cam. It runs almost 24/7. Using crontab the pi will reboot every night at midnight and the script will begin running again. This is mostly ...
StarSweeper's user avatar
5 votes
1 answer
7k views

Cronjob is set to run every 5 minutes but runs every minute

I have a problem with my python script. It looks like this: #!/usr/bin/python import time import serial import datetime import sys Y = datetime.datetime.now().strftime('%Y')[3] filedate = datetime....
BallerNacken's user avatar
5 votes
2 answers
7k views

How to automatically run a Python GPIO script at boot?

I am using Raspbian. I have created a Python GPIO script which is supposed to run at the time of the boot. I have tried to use @reboot in sudo crontab -e. Unfortunately, it is not working at all. I ...
Ashwin Pajankar's user avatar
5 votes
2 answers
2k views

Cron job doesn't work, but runs successfully manually

I have directories in my home folder that hold reports uploaded via FTP. The daily folders are named like YYYYMMDD. At 00:01, I want to delete the folder from four days ago. At 01:01, I want to change ...
user38537's user avatar
  • 203
5 votes
1 answer
13k views

Print output not shown when run Python script CRON

I am automatically running a simple python program from start up using cron. The pi boots / automatically logs in, displays the command line and runs the python program but the print output (updating ...
DONALD's user avatar
  • 51
5 votes
2 answers
504 views

Reboot via cronjob does not work, it just shuts down without booting up again

I want my headless Raspberry Pi to reboot every night. I have the latest firmware (sudo rpi-update) and Raspbian is up to date (sudo apt-get update && sudo apt-get upgrade). For the cronjob I ...
Foo Bar's user avatar
  • 453
5 votes
2 answers
2k views

How do I start the cron daemon automatically on Raspbmc?

I'm not able to start the cron daemon automatically on Raspbmc. I tried to configure an upstart and an init script but had no luck.
DouglasJose's user avatar
5 votes
1 answer
670 views

crontab entry with parameters?

My goal was to make my Pi create its own WiFi on start so that I can connect to it wirelessly. I have succeeded by creating a crontab entry (using sudo crontab -e): @reboot /path/to/create_ap.sh &...
YakovL's user avatar
  • 159
4 votes
1 answer
925 views

How to execute a Python 3 + OpenCV 4 script @reboot on Raspbian Lite (headless)?

The Python script works perfectly fine when ran from the command line while signed in as the "pi" user, with this command: python3 /home/pi/www/main.py & But from the crontab, it just doesn't ...
that-ben's user avatar
  • 221
4 votes
3 answers
794 views

Python script run from crontab does not recognize USB drive mounted later

I am having a bit of a problem here, I really hope some of you can point me in the right direction: I made a python3 program running a loop and checking if the file /DATALOGGER/DATALOGUSB/SETUP.py ...
Rasmus's user avatar
  • 41
4 votes
2 answers
2k views

crontab job not working properly

I was trying to use my pi and a bluetooth speaker as an alarm clock. I've setup a cronjob by doing sudo crontab -e in the crontab file, I added 40 8 * * 1-5 /home/XXXXX/alarm.sh &> alarm....
Eniaczz's user avatar
  • 61
4 votes
1 answer
9k views

Confirm system crontab functionality on Arch

Arch ARM comes with cronie cron daemon. However I can't find the system crontab file and running crontab -l as root returns no crontab for root. systemctl is-enabled cronie reports enabled I have a ...
ivvi's user avatar
  • 227
4 votes
1 answer
7k views

systemctl daemon-reload issue

Since a last update, I get the follow message every day via mail: /etc/cron.daily/logrotate: Warning: Unit file of apache2.service changed on disk, 'systemctl daemon-reload' recommended. I tried ...
zwolle-rdstk's user avatar
4 votes
3 answers
5k views

Crontab on Rpi not running Python script

I have a simple problem that I cannot seem to find an answer to even though I have done some research. I am trying to run a python script via crontab (I have never worked with crontab before this haha)...
RPiNoob_16's user avatar
3 votes
4 answers
19k views

Why are system logs not rotating?

logrotate.conf says rotate logs weekly, but my logs haven't rotated for 5 weeks. What could be stopping my logs from rotating? Logrotate.conf: # rotate log files weekly weekly # keep 4 weeks worth ...
David Sykes's user avatar
  • 1,435
3 votes
4 answers
8k views

Addition to cron is not executed

I am trying to implement a watchdog script which I basically got from here. Script works fine, starts up process if not running, does nothing if running. Now implementation into crontab gives me ...
user5875's user avatar
3 votes
3 answers
3k views

Get Bash instead of /bin/sh in a VNC session started by cron

When I open a terminal (e.g. lxsession or xterm) in LXDE which is running in a VNC session the shell is $ echo $SHELL /bin/sh However, I want my default shell which is /bin/bash to use my .bashrc ...
Frank Breitling's user avatar
3 votes
3 answers
3k views

Code/Cron to detect low power and safe shutdown on GPIO

I've made a portable wildlife camera which uses a 8 x AA UBEC battery pack and I am looking for a way to safely shut down the RPi when the power starts to get low. Is there currently any code that I ...
Ryan Lloyd's user avatar
3 votes
2 answers
33k views

How do I pass a variable to a python script run from crontab? [closed]

I am running a python script using the following command: 0,30 * * * * python /home/pi/pythonscripts/script.py & and I would like to pass a variable 'test' to the script in the crontab, ...
JBithell's user avatar
  • 163
3 votes
2 answers
5k views

How to disable emails from Crontab?

I've got my Model B Pi setup running Raspbian OS. I have added a few jobs to Crontab and they're working very well. My problem is that I am getting an email each time a job runs. I don't need the ...
Peter's user avatar
  • 133
3 votes
4 answers
7k views

How do I create a cron job to execute PHP?

I've been trying to execute a PHP file via a cron job, but I can't seem to get it to work. I've set the permissions of the relevant file to 777. Here is the line I've currently got in the crontab file....
Ross's user avatar
  • 59
3 votes
1 answer
2k views

Launch Python script from Cron in foreground

I have developed a Python script that I would like to run at every boot of the Pi. The script in question is one that I do not want to run in the background. It will be controlling the display of ...
Daniel's user avatar
  • 171
3 votes
2 answers
4k views

/dev/null folder doesn't exist. Should I create it?

I am pretty new to the Rasperry Pi (and linux in general). I am currently using it as an irc bouncer. I have set a cron entry to make it check to see if znc is running every 10 mins. */10 * * * * /...
Mike's user avatar
  • 33
3 votes
1 answer
4k views

Editing crontab within python

I have a RPi 3 running Raspbian Stretch. My plan is to write a Python program to control a 4-relay module to switch lights on and off at predetermined times. I’ve used tkinter to create a UI to ...
DickFromMK's user avatar
3 votes
3 answers
2k views

How do I add a task to Crontab

I am making a program for the Raspberry Pi to use, as part of its installation, it need to add a task to crontab so that it will run on bootup. I know if I type in crontab -e then add the line "@...
user5062278's user avatar
3 votes
1 answer
1k views

cec-client works when run from cli but not from cron

So when I run either of the following from the cli (SSH session) my pi will turn on my Samsung TV: echo "as" | cec-client -s echo "on 0" | cec-client -s However when I but either of these into cron ...
Andy B's user avatar
  • 61
3 votes
2 answers
14k views

Cronjobs not working

I've got a problem with my cronjobs and I'm not able to solve it on my own. That's what i wrote into crontab -e (with newline at the end): SHELL=/bin/bash */1 * * * * /home/pi/Projekte/C/CRONTEMP.sh ...
scherzkrapferl's user avatar
3 votes
1 answer
432 views

Cron running 2hrs early

I checked the time on my pi to make sure it's right by running date and I believe I set my cron job correctly, I wish for it to run at 9am and 9pm, but they're running instead at 7am and 7pm. Here's ...
basica's user avatar
  • 43
3 votes
1 answer
2k views

Cronjob not working - meant to post tot Twitter

I'm trying to get my Pi to post the amount of used RAM to Twitter. I'm using a script I modified myself from here, although I'm not very proficient in bash.. This is the file, it is located in /...
Hugo's user avatar
  • 63
3 votes
1 answer
744 views

Pygame.mixer does not play sound when started in cron

I have written a small python script that plays a track after the press of a button (and ignores further button presses until the track has completed). The script works perfectly fine when started ...
robertmusil's user avatar
3 votes
2 answers
6k views

Cron jobs and python scripts

On Raspbian, I created a crontab file using the following command: sudo crontab -e Added the following lines to cron @reboot /usr/bin/python3 /home/pi/dev/bootscripts/ipchecker/ipchecker.py 0 * * * *...
Jorge Vidinha's user avatar
3 votes
3 answers
1k views

When to call script that can capture IP in python

I'm trying to show my local IP on an LCD during startup. My script worked fine during normal testing via the command line, but when called at startup it doesn't seem to be able to fetch the IP. I ...
EDP's user avatar
  • 1,661
3 votes
2 answers
628 views

Crontab not executing php scripts

My problem is that crontab is not executing my php script /home/pi/CronTabFiles/saveThermometer.php I tried a lot of things, I don't remember everyone of them but I'll list what i consider mains one. ...
ksiadz510's user avatar
3 votes
1 answer
794 views

Run turn off/on HDMI on specific time

I want to do the following: Use my raspberry pi as a smart display, kind off like what the Chromecast does when it's not streaming anything. I also want it to turn on and off at certain times, like ...
Waenger's user avatar
  • 31
3 votes
0 answers
81 views

How can I reduce the memory usage of my python3 scripts on a Raspberry Pi Zero 2? [closed]

I created 9 python scripts that I run as cron jobs. When I run them on a VirtualBox virtual machine running Ubuntu Server 20.04 with 512MB of RAM with a single processor, everything runs smoothly and ...
Serge Charbonneau's user avatar
3 votes
0 answers
2k views

Script not working with crontab, works manually

I have a problem with a script not working when executed via crontab. I've already searched for similar problems, but none of the usual solutions seem to work. I'm using a RPi3 with raspbian stretch ...
Chris's user avatar
  • 31
2 votes
5 answers
2k views

Why is cron needed for Raspbian?

I was looking for some sort of process that is lagging my device. While searching I found that cron is running. If I understand this correctly then cron is needed to run serials of command at a ...
Sohan Arafat's user avatar
  • 1,808
2 votes
4 answers
3k views

trigger cron job from web application

I would like to improve on my project by using cron jobs. Currently, i have a web application that allows me to control servos. However I would like to add another function on the web application ...
yvonnezoe's user avatar
  • 401
2 votes
1 answer
21k views

Where is the cronfile located? [closed]

I am writing a python program to go on the raspberry pi. I am currently making an installation script that will as part of its installation process, add a line on cron so that it will automatically ...
user3346931's user avatar
2 votes
2 answers
413 views

What's wrong with this little python script?

I followed this tutorial to log my CPU temperature into a .csv-file and try to run the .py script it at bootup with cron. The script: from gpiozero import CPUTemperature from time import sleep, ...
WaveRipper's user avatar
2 votes
2 answers
2k views

Cron for Raspberry Pi

I'm running a program on one of my PIs that has a tendency to error out. I'm still trying to figure out the error but would like a cron entry (or maybe a python script, or most likely both) that will ...
Ken's user avatar
  • 21
2 votes
1 answer
887 views

What is the environment for cron?

When issues arise using cron to schedule events, a frequently-heard explanation is that cron runs with a different set of environment variables than a "normal" user (e.g. pi). That's all well and good,...
Seamus's user avatar
  • 20.3k

1
2 3 4 5 6