Tag Info

31

Edit this file sudo nano /home/pi/.config/lxsession/LXDE-pi/autostart And add this: @xset s off @xset -dpms @xset s noblank @chromium-browser --kiosk http://google.com/ # load chromium after boot and open the website in full screen mode Then reboot. Chromium should automatically launch in fullscreen mode after the desktop has loaded.

16

In Unix/Linux systems, lots of OS background tasks are run as cron jobs. To see what won't run if you stop the cron daemon, type these commands: ls -la /etc/cron.hourly ls -la /etc/cron.daily ls -la /etc/cron.weekly If you really know what you are doing, and you are quite sure you can deal with the consequences, only then shut down cron. Here are my ...

14

Since you don't have Internet NTP, the file timestamps are meaningless, being reset to the Pi's "/etc/fake-hwclock.data" time whenever the system is booted. If the daily data file(s) have a standard name ( e.g. /PATH/sensor1.data or common tag ( e.g. the ".data" ) you can use savelog ( or logrotate ) to save only the most recent ( e.g. &...

10

cron runs tasks (system or user chosen) which need to be run at regular intervals. By itself it uses negligible resources. I suggest you leave cron alone.

9

on chromium you can use --start-fullscreen (like F11)

8

From man 5 crontab: Step values can be used in conjunction with ranges. Following a range with "/<number>" specifies skips of the number's value through the range. For example, "0-23/2" can be used in the 'hours' field to specify command execution for every other hour (the alternative in the V7 standard is "0,2,4,6,8,10,12,14,16,...

8

As is typical with crontab issues. The environment is not the same as your user or even a sudo/root shell , and env python3 may not return anything (env simply searches through Instead you should explicitly use the full path of python which can be found either as which python3 or which $(env python3) and use that full path in your crontab (typically /usr/... 7 Like most Debian based systems, the crontab is stored in /var/spool/cron/crontabs On a different note: Why are you trying to start your program using crontab? This is neither a good nor a standard practice. If you're going through the effort of writing an installer, you should be using an init script so that the user has the ability to issue start/stop/... 7 On a system where the time resets on boot, you can't know what time it is when the system starts, and similarly can't know how long it was when the system was down. But you can count reboots, and you probably have a clock that works while the system is up. Have a global counter ("run id"), stored in a file or database, or whatever, that you ... 6 besides the obvious (removing MAILTO line), you may also try to redirect the output of your scripts to /dev/null, since if the script has any output it will be sent to the user this script belongs to by default. add something like this to the end of offending scripts in crontab: >/dev/null 2>&1 the first part '>/dev/null' redirects stdout, the ... 6 The easiest way to have something run at boot is via /etc/rc.local. Some systemd based distros (e.g., Arch and Fedora) have stopped including this, although it is easy to implement. Which doesn't matter in this case since currently Raspbian does still have that file. It probably contains something about printing the IP address to console, but don't worry ... 6 There is NO NEED to do anything before a reboot. If you issue a sudo reboot command Linux will manage an orderly shutdown of the software. This is, however, a poor way of ensuring a reliable 24/7 system. If it crashes there is no guarantee the reboot itself would happen. The normal solution would be to use a watchdog timer. The Pi has an inbuilt hardware ... 6 If you want to run cron jobs with start times relative to sun up/down or twilight then you could use sunwait It will determine the correct time to wait, based on your location's coordinates. Simple example running echo 1 hour before sunrise: # m h dom mon dow command 01 00 * * * /usr/local/bin/sunwait sun up -1:00:00 52.518N 1.475W; /bin/echo "... 6 As I understand your question: You have a cron job to reboot your RPi every night at 01:00; e.g. 0 1 * * * sudo reboot (#or something similar; e.g. shutdown -r now) You have a 2nd cron job to restart your app using the @reboot facility in cron; e.g. @reboot /path/to/your/flask/app If you're certain that your 01:00 reboot is being executed successfully, ... 6 Raspbian includes fake-hwclock, which saves the clock to the SD card on shutdown and restores it on boot. However, if you're just cutting the power to restart it, this is fairly useless; it will never shut down, so it'll keep restoring the last-saved time which is the same as always. Deanna Earley's solution is to add a line to /etc/crontab: * * * * * root ... 5 I know I'm a little late to the game here, but since I found a reason for this not working for me, I wanted to help others: This happened to me too, and I discovered a resolution yesterday. Check to see if any of the compressed files (particularly all the *.1.gz fiels) have 0 bytes? Technically this file exists, but the script sees it as empty, and ... 5 The ampersand (for sending a process in the background) is not necessary for commands issued to cron via the crontab as processes are already forked. The given examples work fine without the &. Actually the first version shows working parameters as it invokes the python interpreter with the filename of the script to be executed as parameter. 0,30 * * * ... 5 The following is an excerpt from the 'Raspberry Pi: Measure, Record Explore' book. It doesn't have the script for the restarting, but at least it will give you a going over of setting crontab. Consider that we wish to run a Python script every day at 6am. The following command will let us edit the crontab; crontab -e Once run it will open the crontab in ... 5 To run in foreground you'd need to add DISPLAY=:0: @reboot DISPLAY=:0 \usr\bin\python3 \home\pi\Desktop\photo_frames\get_random_row.py > /logs/cronlog Or open it explicitly with xterm: @reboot DISPLAY=:0 xterm -e \usr\bin\python3 \home\pi\Desktop\photo_frames\get_random_row.py /logs/cronlog Generally if it's Python, you could use logging library ... 5 will the entire system halt until the network is up No. where in the boot-up sequence is crontab activated? Crontabs are managed by cron, a system daemon started by init, which on Raspbian jessie is systemd. Exactly when a service is started in terms of time depends on what it depends on, and a degree of indeterminacy, since things that do not depend ... 5 We can ask cron to tell us what its environment is. Create a shell script in your home directory (~/) as follows (or with the editor of your choice):$ nano ~/envtst.sh Enter/C+P the following in the editor: #!/bin/sh echo "env report follows for user "$USER >> /home/pi/envtst.sh.out env >> /home/pi/envtst.sh.out echo "env report for ... 5 Cron is actually very useful. Say you wanted to run a program once a day, then cron is your friend. You can schedule to run a program at any time during the day. I would definitely leave it on your pi. ;) 5 You've run into a well-known limitation with cron. The question has been asked and answered here many times. This recent example highlights the two (at least two) choices you have: use cron (older, simpler) use systemd (newer, more complex) The answer to your question in the context of cron usage is this: If your script runs from the command line, but ... 4 Be sure that the crontab file is not executable or writable by other users. You should edit the file with crontab -e filename rather than with a general purpose editor. cron needs to be told to re-read crontabs after a modification thereto, with SIGHUP. I believe (but RTM to be sure) that crontab -e will send the signal but if you use another method to edit ... 4 supervisord is such a monitoring daemon. It can launch processes when it starts (though this can be disabled, so processes are manually started). If a process crashes, it will be restarted. As a bonus, it has a nice web interface: 4 cron scripts most likely lack PATH variable, therefore you have to specify the full path to your executables, that you could easily find using: which ifconfig and which date, and your script might look like this: #!/bin/sh /bin/date >> /media/log/crontest.txt /sbin/ifconfig tun0 >>/media/log/crontest.txt 4 Show us your logrotate.conf. Delete your state file /var/lib/logrotate.status and do logrotate -f /etc/logrotate.conf as root. Post back any error messages. You are running logrotate as a cron job? As root? 4 As others have noted in the comments, you need to redirect the output from the command somewhere. This will write to a file, overwriting the file if it already exists. @reboot python /home/pi/Python27/pimon.py > /path/to/output_file.txt Change > to >> if you want to append to an existing file. Check this link for more information on standard input ... 4 Try to use absolute paths inside your bash script. read ip1 < ip.txt and echo "$ip2" > ip.txt Change ip.txt to /home/pi/ip.txt or something like that. The other thing would be the crontab line itself. Why do you have the "pi" there? It goes: minute hour day_of_month month day_of_week command If you want it to execute with the pi user, just ...

Only top voted, non community-wiki answers of a minimum length are eligible