No longer works in V4

General support for the Pi-Star System
M6NBP

No longer works in V4

Post by M6NBP »

In Pi-Star:3.4.17 / Dashboard:20191220 I have used a line off code to reboot the Pi-Star every day in the System Cron.

15 4 * * * root reboot >/dev/null 2>&1

This has worked with no issue from day one.

But in Pi-Star:4.1.0-RC7 / Dashboard: 20191206 it has never worked.

Has the coding changed in Pi-Star?

Can anyone help fix this line of code so I can get it working again?


Many thanks
Norman
User avatar
G8SEZ
Posts: 555
Joined: Fri Apr 13, 2018 8:26 pm

Re: No longer works in V4

Post by G8SEZ »

I would suggest adding a space between the first > and the /dev/null
--

Brian G8SEZ
M6NBP

Re: No longer works in V4

Post by M6NBP »

Sorry to say that did not work.
User avatar
G8SEZ
Posts: 555
Joined: Fri Apr 13, 2018 8:26 pm

Re: No longer works in V4

Post by G8SEZ »

What does

Configuration->Expert->System Cron

from the dashboard show?
--

Brian G8SEZ
M6NBP

Re: No longer works in V4

Post by M6NBP »

# m h dom mon dow user command
50 14 * * * root reboot > /dev/null 2>&1
*/5 * * * * root /usr/local/sbin/pistar-upnp.service start > /dev/null 2>&1 &
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 3 * * * root mount -o remount,rw / && cd / && run-parts --report /etc/cron.daily
47 3 * * 7 root mount -o remount,rw / && cd / && run-parts --report /etc/cron.weekly
52 3 1 * * root mount -o remount,rw / && cd / && run-parts --report /etc/cron.monthly
kc7ngc
Posts: 48
Joined: Fri Sep 21, 2018 2:47 am

Re: No longer works in V4

Post by kc7ngc »

There any errors in the log files?

fgrep CRON /var/log/syslog

In theory should see an entry with a timestamp around the time you have for the scheduled execution of the job. That would narrow down whether it's an issue with job not running as scheduled or an issue that its trying to execute on time but failing.
M6NBP

Re: No longer works in V4

Post by M6NBP »

pi-star@pi-star(ro):~$ fgrep CRON /var/log/syslog
Dec 24 14:44:14 pi-star cron[379]: (CRON) INFO (pidfile fd = 3)
Dec 24 14:44:14 pi-star cron[379]: (CRON) INFO (Running @reboot jobs)
Dec 24 15:09:01 pi-star CRON[10539]: (root) CMD ( [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Dec 24 15:39:01 pi-star CRON[11594]: (root) CMD ( [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Dec 24 16:09:01 pi-star CRON[12603]: (root) CMD ( [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Dec 24 16:39:01 pi-star CRON[13609]: (root) CMD ( [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Dec 24 17:09:02 pi-star CRON[14488]: (root) CMD ( [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Dec 24 17:39:01 pi-star CRON[15462]: (root) CMD ( [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Dec 24 18:09:01 pi-star CRON[16438]: (root) CMD ( [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Dec 24 18:39:01 pi-star CRON[17518]: (root) CMD ( [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
kc7ngc
Posts: 48
Joined: Fri Sep 21, 2018 2:47 am

Re: No longer works in V4

Post by kc7ngc »

ok, something must be corrupted with the crontab file as none of the cron jobs from /etc/crontab are running. In that time internal should at least see cron.hourly running in the logs.

In your log snippet the only cron job that is firing off is the php job which is under /etc/cron.d/php but everything in crontab file isn't executing at all. Should see something like below where cron.hourly is firing off at 17 minutes after the hour. So something is mucked up.

Code: Select all

Dec 24 10:17:19 pi-star cron[261]: (CRON) INFO (pidfile fd = 3)
Dec 24 10:17:19 pi-star cron[261]: (CRON) INFO (Running @reboot jobs)
Dec 24 10:39:01 pi-star CRON[11839]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Dec 24 11:09:01 pi-star CRON[6485]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Dec 24 11:17:02 pi-star CRON[13723]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Dec 24 11:39:01 pi-star CRON[1053]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Dec 24 12:09:01 pi-star CRON[28080]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Dec 24 12:17:01 pi-star CRON[2880]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Dec 24 12:39:01 pi-star CRON[22667]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Dec 24 13:09:02 pi-star CRON[17281]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Dec 24 13:17:01 pi-star CRON[24408]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Are permissions correct on the file?
ls -la /etc/crontab
should return something like:
-rw-r--r-- 1 root root 785 Dec 18 21:33 /etc/crontab

How did you edit the crontab file? Did you edit it on a windows PC and copy the file back or did you edit it on the system running pistar? Could be file is corrupted, has some DOS formatting in it or something that is causing it not to be read by cron.

I went into my system and changed the crontab file to look like the following, with only change is adding last line to reboot at 13:35 and it worked.

Code: Select all

# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=""

# m h dom mon dow user  command
#*/5 *  * * * root /usr/local/sbin/pistar-upnp.service start > /dev/null 2>&1 &
17 *    * * * root    cd / && run-parts --report /etc/cron.hourly
25 3    * * * root mount -o remount,rw / && cd / && run-parts --report /etc/cron.daily
47 3    * * 7 root mount -o remount,rw / && cd / && run-parts --report /etc/cron.weekly
52 3    1 * * root mount -o remount,rw / && cd / && run-parts --report /etc/cron.monthly
35 13 * * * root reboot > /dev/null 2>&1
So I think somehow the crontab file is mucked up in some way.
kc7ngc
Posts: 48
Joined: Fri Sep 21, 2018 2:47 am

Re: No longer works in V4

Post by kc7ngc »

ok, just ran a test to see if error would output when I intentionally mangled my crontab file. If there is a typo or a formatting issue in the file it should be generating an error message.

What is output of:
fgrep crontab /var/log/syslog

Should see something like the following (assume error will be different) when cron failed to read crontab file.

Code: Select all

Dec 24 14:03:01 pi-star cron[247]: (*system*) RELOAD (/etc/crontab)
Dec 24 14:03:01 pi-star cron[247]: Error: bad username; while reading /etc/crontab
Dec 24 14:03:01 pi-star cron[247]: (*system*) ERROR (Syntax error, this crontab file will be ignored)
In my case I just mangled the username in an entry to make sure it generated an error. In theory error message you get should indicate what is wrong with the crontab file.
M6NBP

Re: No longer works in V4

Post by M6NBP »

pi-star@pi-star(ro):~$ ls -la /etc/crontab
-rw-r--r-- 1 root root 824 Dec 24 22:09 /etc/crontab

I add the code via windows PC and copy the file back the same as I did on version 3

I just tried add the code to the last line and that did not work.

This is a fresh install only a week or two ago.


.
Post Reply