New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with cron and auto backup (from v6.10-6.11)? #1901
Comments
@eljotx
On non-interactive executions, the script would exit, if (close to) insufficient free space is detected on target drive: https://github.com/Fourdee/DietPi/blob/master/dietpi/dietpi-backup#L456 About the log entries, some cryptic colour codes + |
Strange. Try running the cron job and paste log results NB: |
So, i try running the cron job without G_USER_INPUT=0 (I removed this from script) and... My backup log file from /mnt/rpi/backup.log dietpi-backup.log is empty I did not see any active process after time when cron started. So, I added to testing another script, to see output in file after cron start:
but this script not started - there is no file "cronworks.log" at /mnt/rpi/ |
@eljotx Also it should not be needed, but try to use |
Script always had a name "backup" (without .sh), I change "#!/bin/sh" to "#!/bin/bash" in script too, and this script has owned by root. My "test" script from last post working now too. I tried everything, but still is not working. I change script to print to log file after finish one job and I saw that script starts, but backup isn't start or finished (dietpi-backup.log is empty), because can't go to next job like tar, rclone etc. And also after running cron I saw process /usr/sbin/cron -f working and -bash - it's normal? Script still working if I run it manually - but when backup finish, I must click OK and Cancel (whiptail screens), and after that - next jobs starts. I think that problem is with using dietpi-backup to auto backup started by cron. It worked on 6.9 version, but no working after rewriting dietpi-backup. |
@eljotx
works as well, showing all got executed and finished in
If all the above is true, then could you try to manually start run-parts and see if it executes as expected:
|
I tested as you show and on every your question: yes, everything working when I start it manually. My script is listed after use If I add G_USER_INPUTS=0 and start script manually, should I see the screens (whiptail) with information about log etc.? Because I see it always. |
@eljotx To force it for the script, you need to either export it before executing script:
or easier just directly give it over: I just recognized that you used But if not the variable is exported, scripts will determine, if user inputs can be made or not. Within cron and e.g. systemd unit executions, all DietPi scripts should automatically determine and assign |
First I test Next I try to change my script to this:
and dietpi-backup.log is still empty, but backup.log: when cron started and automatically start this script:
when I started script manually:
|
It's very annoying... next, my script only has:
and still not working if this script is started by cron. Problem is still with dietpi-backup started by cron from v6.10. I think that is problem with changes did you made in v6.10 in dietpi-backup script. dietpi-backup.log is still empty |
@eljotx |
Made some own testing:
After commenting root user check, within
|
@eljotx
Fix: Fourdee@82ac7b3 |
This patch also fixes another problem: "run_ntpd 1" run by cron daily or hourly does not sync the time (the timestamp of /var/lib/systemd/clock does not change). |
@kmakisara I think some of our opened issues are related to this. If I am just wondering, why this issue showed up first with v6.10+, as we used
|
Further testing on this:
|
Test on v6.9:
APT update contains no cron and/or ncurses (reducing by tested unrelated packages):
- Okay, it IS related to globals changes, but since |
Related change identified: https://github.com/Fourdee/DietPi/blob/master/dietpi/func/dietpi-globals#L266
showed the error, but allowed script to go on (see above). Fix Fourdee@82ac7b3 works and is also the cleanest solution, as |
+ DietPi-Globals | G_DIETPI-NOTIFY: Further hardening tput error prevention within non-interactive shells: https://github.com/Fourdee/DietPi/issues/1901#issuecomment-405093777 + DietPi-Globals | G_DIETPI-NOTIFY: Prefer "if" statements instead of "return" to let function finish and clean up.
@eljotx @kmakisara I will close this issue in favour of the new one. |
I could successfully ssh into my v6.13 but it would hang right after. The "tput cols" command was outputting tput: unknown terminal "rxvt-256color", resulting in an empty value on line 328 of dietpi-login, making it hang forever after having successfully read the database upon initial boot. Exporting TERM=xterm, an ugly hack, seemed to have fixed the login script, and can now begin install. If this is the wrong section please be patient, for i don't really know how to use github issues; I have found this thread after hours of useless googling for an error, if you move it maybe leave a remainder about rxvt-256color errors, in case someone has my same problem. Best regards! |
Hi, Thanks for the report and solution 👍 Which SSH client are you running? |
@Fourdee @wuhei
An alternative would be to install a package that contains more terminal definitions: |
@Fourdee OpenSSH_7.7p1, OpenSSL 1.1.0h on Arch Linux @MichaIng thanks glad I could help by chance! Please keep in mind I am a bad sysadmin and by following this article by Tom Ryder i have found out I had a pretty misconfigured terminal "declaration" config. In the end what fixed the problem for me was
I couldn't scp the terminfo file to my pi, because scp is not installed (maybe consider installing it together with the dropbear server?), so i uploaded it to a server I own and just wget'ted it from the pi. Glad i could help, cheers and sorry again for the mess - rock on! |
@wuhei The article you linked is pretty nice, explaining everything and possibilities very well 👍. So you basically installed the required terminal type manually. The article also mentions the For testing with PuTTY client: PuTTY > About installing SCP: There are several other file transfer protocols, FTP, SFTP or network drives NFS, SMB, to transfer files. I would no pre-install on, but leave choice to user how to get files from client to server. USB stick, external drive of course is also possible or simply copy&paste into SSH terminal in case. But anyway as a general solution I would go with one of the two ways mentioned above. |
Creating a bug report/issue:
Required Information:
Additional Information (if applicable):
Steps to reproduce:
I used custom autostart to X with chromium in kiosk mode (24/7) and do this: https://www.youtube.com/watch?v=P9Sk9bNrzeg
I set a backup (to google drive) that was made by cron in the cron.daily folder - I wrote script:
Expected behaviour:
This script worked good up to version 6.9 of DietPi when it was run from cron.daily.
Script working well when I run it manually.
Actual behaviour:
After update to v.6.10 and v.6.11, script not working from cron.daily, but working well when manually start.
Extra details:
On backup.log i have a incomprehensible string of characters with string like this: checking for elevation root access.
Also it isn't start from crontab.
The text was updated successfully, but these errors were encountered: