Edit this file
sudo nano /home/pi/.config/lxsession/LXDE-pi/autostart
And add this:
@xset s off
@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.
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 ...
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. &...
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,...
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/...
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/...
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 ...
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:
the first part '>/dev/null' redirects stdout, the ...
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 ...
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 ...
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 "...
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.
If you're certain that your 01:00 reboot is being executed successfully, ...
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 ...
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 ...
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 * * * ...
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;
Once run it will open the crontab in ...
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 ...
will the entire system halt until the network is up
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 ...
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:
echo "env report follows for user "$USER >> /home/pi/envtst.sh.out
env >> /home/pi/envtst.sh.out
echo "env report for ...
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. ;)
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 ...
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 ...
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:
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/date >> /media/log/crontest.txt
/sbin/ifconfig tun0 >>/media/log/crontest.txt
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?
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 ...
Try to use absolute paths inside your bash script.
read ip1 < ip.txt
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 ...