Page 2 of 2
Re: No longer works in V4
Posted: Tue Dec 24, 2019 10:24 pm
by M6NBP
pi-star@pi-star(ro):~$ fgrep crontab /var/log/syslog
Dec 24 22:09:39 pi-star cron[362]: (*system*) ERROR (Missing newline before EOF, this crontab file will be ignored)
Dec 24 22:19:01 pi-star cron[362]: (*system*) RELOAD (/etc/crontab)
Dec 24 22:19:01 pi-star cron[362]: (*system*) ERROR (Missing newline before EOF, this crontab file will be ignored)
Re: No longer works in V4
Posted: Tue Dec 24, 2019 10:35 pm
by M6NBP
The above was after I swamped out the corn with your setting.
I then removed all and saved.
Took a direct copy from the V3 and added.
Now it is working
# /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
33 22 * * * 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
Will set for 4.14 am and see if it works tomorrow
Re: No longer works in V4
Posted: Tue Dec 24, 2019 10:41 pm
by M6NBP
pi-star@pi-star(ro):~$ ls -la /etc/crontab
-rw-r--r-- 1 root root 826 Dec 24 22:37 /etc/crontab
pi-star@pi-star(ro):~$ fgrep crontab /var/log/syslog
Dec 24 22:38:01 pi-star cron[378]: (*system*) RELOAD (/etc/crontab)
Re: No longer works in V4
Posted: Tue Dec 24, 2019 10:54 pm
by kc7ngc
M6NBP wrote: ↑Tue Dec 24, 2019 10:23 pm
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.
Knew what was going on as soon as you said windows PC. Windows terminates lines with CR+LF (\r\n) while linux uses only LF(\n). Unless you are using an editor like Notepad++ on windows that recognizes a ascii linux text file then editing a text file on windows will convert the EOL from a LF to CR+LF which will cause linux system problem when you copy the file back.
So when you edited on the PC, it changed the file to a format that is confusing cron daemon. In the future if using a windows PC to edit config files from the pi-star use notepad++ and make sure you convert the EOL to unix format (if necessary) before you copy the file back to the pi-star:
https://notepadunix2dos.info/ You would be doing the opposite of what it is showing on that page. You would be selecting "Unix (CR)" for EOL conversion before copying file back to the pi-star. If the option of "Unix (CR)" is greyed out when you select EOL conversion, just means no conversion necessary file is already in correct format.
Or on the pi-star can you can convert the windows EOL to linux EOL doing the following. The code below basically replaces the CR+LF to LF inplace on the crontab file.
Code: Select all
rpi-rw
sudo perl -pi -e 's/\r\n/\n/g' /etc/crontab
Re: No longer works in V4
Posted: Tue Dec 24, 2019 11:05 pm
by M6NBP
Well fingers crossed it is now sorted and will reboot at 4.15 am.
Thank you for all your help and I will keep you updated tomorrow.
Merry Xmas
Norman
Re: No longer works in V4
Posted: Wed Dec 25, 2019 5:15 pm
by AF6VN
Seem like installing
Code: Select all
pi-star@pi-star-3b(ro):~$ apt search dos2unix
Sorting... Done
Full Text Search... Done
dos2unix/stable 7.4.0-1 armhf
convert text file line endings between CRLF and LF
would be easier than remembering some cryptic substitution command
Of course, from my viewpoint, I wouldn't touch the system crontab file... I'd have used
sudo crontab -e
and added that reboot entry to the "root" (personal) crontab file. "crontab -e" would verify the entries are valid, giving one the chance to correct them.
Unfortunately, there does not appear to be any way to have "crontab -e" edit the system crontab; only user specific tables.
Re: No longer works in V4
Posted: Wed Dec 25, 2019 7:28 pm
by M6NBP
All worked today.
So I am going to leave well alone.
.
Re: No longer works in V4
Posted: Wed Dec 25, 2019 10:57 pm
by G8SEZ
Try ensuring that there is no carriage return or line feed after the end of the last line in the file.