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
0 votes
1 answer
22 views

No sound with mpg123 or mplayer at boot

What I want to do : at boot, start a playlist on a headless RBPi A+ through the headphones jack using mpg123. I Wrote a shell script targeting mpg123: #!/bin/bash # see if (and when) my script was run ...
0 votes
2 answers
32 views

Cronjob not executing when raspberry pi reboots

The following is the Python script that I want to execute every time Raspberry Pi reboots. When I run this Python script directly from the terminal it works. Not only does IP gets stored in the file ...
23 votes
6 answers
67k 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.
0 votes
1 answer
497 views

Running ruby script with eventmanager on startup

I hope somebody can help me with the following. I need my Raspberry to run a ruby script on startup which uses ruby's eventmachine package. I've installed rvm, the correct ruby version (2.1.0-dev), ...
-1 votes
1 answer
25 views

Python script started by crontab ends immediately

I'm trying to start a python script using crontab that runs in the background. I want to restart it every few hours, but for now I'm trying to test it every minute to make sure the crontab is working. ...
0 votes
2 answers
311 views

python cv2 module not found when triggered by crontab

My python script imports cv2, and it works fine when I start the script manually. If I set the script to launch on boot (either via crontab, or via a .desktop file (in the user/.config/autostart/...
1 vote
2 answers
220 views

Can't get Cron to run python script

I'm trying to set up porkbun dynamic dns python script to run at reboot via Cron (later I'd like to run it hourly, but baby steps...) following porkbun's tutorial https://www.youtube.com/watch?v=...
5 votes
1 answer
690 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 &...
1 vote
2 answers
129 views

Reboot via `crontab` does not work on Raspberry Pi 4

I'm trying to configure a periodic reboot of my Raspberry Pi 4 via crontab (reboot every Wednesday and Sunday at midnight). However, the Raspi actually never reboots. Here's a summary of my different ...
2 votes
2 answers
439 views

Rotate display on startup

I try to rotate my display on startup. (Console, NOT X11) I do not really care if this happens before the bootup-sequence or afterwards. As long as the display is rotated once the login-prompt appears ...
0 votes
0 answers
100 views

Raspberry Pi 3B+ freezes on cron reboot

I set up a cronjob on my Raspberry Pi 3B+ (1GB RAM) to reboot every morning, which worked fine for over a year. For three days, however, the RPi has been crashing immediately after reboot. By “...
6 votes
3 answers
8k 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 ...
2 votes
1 answer
22k 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 ...
3 votes
0 answers
185 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 ...
1 vote
1 answer
219 views

Playing audio with Python scrpitpt run from Cron

I have a USB sound card connecting mic & speakers to a Raspberry Pi Zero W + The following script plays audio fine when run from the terminal. However, when run from cron, nothing can be heard. ...
1 vote
2 answers
248 views

Python script will not write out file when scheduled (cron or bash.rc)

I have a python script to record a .mp4 file with picamera2 which executes and save correctly when run through the editor (thonny) and through the terminal. However, when I schedule it through crontab ...
-1 votes
1 answer
884 views

How to start a VNC session correctly on Raspbian?

I start my VNC server via a @reboot vncserver & entry in my user's crontab. But this seems to cause some problems since the cron environment is restricted. For examples see: Get Bash instead of /...
0 votes
4 answers
788 views

Crontab or cron.d to run a wav file. What am I doing wrong?

I have been at this for a month now. New to programming. Trying to run a schedule for wav files to execute. Using Raspberry Pi 3 and Raspbian Stretch. My cron.d file called 'BellCron' is as ...
1 vote
0 answers
212 views

Retain persistent Wi-Fi connection on Raspberry Pi

I have a Raspberry Pi that I need it to remain connected to my WiFi constantly (at least as soon as the WiFI becomes available). In practice, however, I have noticed that when there are problems with ...
0 votes
1 answer
60 views

Cronjob does not work anymore after copying it

I recently reinstalled my Raspberry Pi after I changed the microSD-Card. I copied all my cron jobs manually (in /var/spool/cron/crontabs/) and after I imported them with root on my new installation, ...
0 votes
1 answer
693 views

`crontab` fails to run Python3 code at boot (no GUI involved)

After searching for some time- I can;t find the reason that my python3 code won't execute during boot. I'm using Rpi Zero, using StrechLite OS. Code run OK when is executed from command line. crontab ...
0 votes
3 answers
622 views

Running Script on Crontab but it doesn't access WiFi connection

I am running a script using crontab at reboot but somehow the part of the code where some file is being sent to a S3 bucket in AWS, doesn't work. I have included an initial wifi check in the same ...
-2 votes
1 answer
191 views

Running python script at reboot

On a headless raspberry pi I want to run a python script at reboot which continuous to run using tmux. From time to time I connect via ssh to get the data my python script collects. All works fine ...
0 votes
0 answers
69 views

crontab fails in fresh installation

looking for quick answer. Fresh install of RPi, installed a couple of libraries to support my code. ran code successfully. Tried to create a bootstrap using crontab to automatically load and run my ...
1 vote
0 answers
268 views

Fetch and pull git repo on boot

I have a cron job set up to run boot.sh on reboot, and log the input to debug.txt. @reboot cd /home/<user>/code/seasons-pixel-clock/ && (sudo bash boot.sh) > debug.txt The contents ...
2 votes
1 answer
82 views

How to open PI for network traffic on a schedule [closed]

In an attempt to reduce risk to an IOT device I'd like it to enable wifi on a schedule, say only between 00:00 and 00:03 every day. Only just enough to upload a log file to my server, and then disable ...
3 votes
1 answer
962 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 ...
2 votes
0 answers
51 views

How can I get my python program that uses the requests library to run on boot via the crontab

I am working on creating a python script to retrieve data from a server using the requests library, and then display it on an adafruit led matrix using a raspberry pi. I have a program that functions ...
0 votes
1 answer
154 views

BLE cannot scan after cloning Raspberry Pi 3

I have raspberry-pi 2 and i made a python program. My python program can detect BLE and send scan results using MQTT. The program will run automatically when restarted [Using cron-table]. Then I did ...
1 vote
3 answers
1k views

Run autossh on reboot through crontab

I'm trying to run two command at reboot on my raspberry pi. Here is what I tried : @reboot sudo su - pi -c "screen -dm -S myscript_cron python ~/myfolder/myscript.py" @reboot sudo su - pi -c "screen ...
2 votes
3 answers
186 views

Cannot SSH into periphery RPis from master RPi using python script automated from crontab: Host key verification failed

Project Overview I have a series of RPi 3B+ which collect T/RH data using connected sensors. These "periphery" units collect data every 5 minutes, append the data to a CSV file that holds a ...
0 votes
1 answer
2k views

How to run libcamera-still in python trough crontab?

I'm trying to make a time lapse using crontab to manage time intervals. The camera I use is an arducam Autofocus imx519. The libcamera-still command works normally when run via terminal. But when I ...
4 votes
1 answer
999 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 ...
0 votes
1 answer
3k views

Cron jobs not running when specific time specified

I have a crontab that looks like this: * * * * * /bin/date >> /tmp/every-minute.log 0 8 * * * /bin/date >> /tmp/eight-am.log The first line works just fine. The second does not seem to fire at ...
1 vote
2 answers
425 views

Crontab can't create logs (Permission Denied)

I have a script that I want to run every hour, and the echo's of that script and other output, I want to be able to read. Now when I take a look at /var/log/syslog, I see some weird stuff that I can't ...
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 ...
0 votes
2 answers
152 views

Cronjob Raspberry Pi not working

I am trying to use my raspi to host a discord bot that every morning publishes the food in my school. I have setup a bronjob with crontab -e but it's not working. Crontab lookis like this: 45 07 * 2-5 ...
5 votes
3 answers
2k 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 ...
1 vote
0 answers
30 views

why won't my raspberry pi python program run at boot up? [duplicate]

i have recently bought a raspberry pi 4 module b to be able to run programs 24/7. but sometimes my power/electricity can go out at which then makes the program stop working. i tested my program in the ...
0 votes
0 answers
271 views

Start mono application on startup

This is my first time using a linux/rasbperry pie and I am trying to start a program I made in c# on my windows on startup. It has a graphical user interface, and can run from the command line using ...
1 vote
1 answer
112 views

.service or crontab for shell script calling python-CLI app and/or python script failing

This isn't necessarily a Pi-specific question, but might be applicable to general Linux. However, my hunch is that the Pi's uniqueness might have something to do with it. I'm trying to run two scripts ...
1 vote
3 answers
1k views

script runs at terminal - but not in cron

I'm logged in as user pi via SSH and have a wifi checking script wifi_test_1.sh in the following directry: /usr/src/scripts/wifi_test_1.sh When i enter the command /usr/src/scripts/wifi_test_1.sh ...
0 votes
3 answers
2k views

How to run a script (pointing to a python file) with root permission at startup in Raspberry Pi OS?

I am trying to run a script which ultimately runs a pagekite python file. The Pagekite offers tunnelling service for localhost to be publicly accessible. My aim is to run the pagekite.py when the Pi ...
39 votes
2 answers
165k 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. ...
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....
0 votes
1 answer
86 views

Bash script wont run under sudo crontab but will under pi crontab

I have a simple script start_chromium.sh: #!/bin/bash DISPLAY=:0 chromium-browser --start-fullscreen --kiosk http://server:8080 When I do sudo crontab -e and add @reboot /home/pi/start_chromium.sh ...
0 votes
0 answers
75 views

Not Able to Change Volume with Cron (tried Python)

Alright, I've been trying this for several days and I'm just dying here... I am putting together a kiosk that should play video. I'm using a NUC with Raspberry Pi Desktop. Everything works but ...
-1 votes
3 answers
971 views

Cannot run a script after reboot using Cron

I'm trying to start a script containing cgminer for mining when the raspberry pi reboots however it doesn't. My crontab contains the following. @reboot sleep 120 && sudo /home/pi/StartVPN.sh @...
0 votes
2 answers
45 views

python code to read SMS not working when running under cron

I made a python code to read SMS from SIM800 module, that is connected to a Raspberry Pi Zero W, and it is working like a charm when I run it on a terminal or another IDE. Here is the expected result: ...
0 votes
1 answer
948 views

Restart lxpanel through shell script; works in shell, but not in cron [closed]

I have a raspberry pi which stays on for extended period of time. To avoid it from crashing, I have a cron job that periodically checks for top memory consuming apps and then restarts them as needed. ...

1
2 3 4 5 6