Problem 1:
I was on logging #1 and everything was going well. The system was generating /var/log/syslog files as expected. Then to keep cron logs, I switched to logging #2 and now I don’t see /var/log/syslog being generated anymore. Next I switched back to logging #1 and I still don’t see the syslog anymore. Can someone help me setup the logging #2 correctly with syslog working as expected.
Problem 2:
I want to run a script as minutely cron job. The file is located at /etc/cron.minutely/alive.sh. I have enabled minutely cron from Dietpi Cron manager but I don’t see the cron job being execute minutely. I can run the script manually though. The permissions are same as on other Dietpi owned hourly cron jobs.
Question 1:
What exactly you like to see in the logs? Anything special you are looking for? You could use journalctl to check what happen on your system.
In general, to get logging enabled, you would need to install rsyslog package
apt-get install rsyslog
this will create /var/log/syslog and /var/log/messages
Question 2:
Files in /etc/cron.*/ are not allowed to have file endings, hence rename abc.sh to abc
Take care it has the shebang #!/bin/bash (or whichever shell works), as those files are not explicitly executed with a specific shell.
Take care it is executable: chmod +x /etc/cron.minutely/abc
Check if it would be executed: run-parts --test /etc/cron.minutely/
Just for reference, as the bid strict rules of run-parts, used to execute the files in those dirs, I link the man page: https://manpages.debian.org/run-parts
run-parts reference was a good learning. After the fixes you told for Cron, the job is working well now. So that part is all good.
Regarding the logging, I confirmed by running dpkg -l rsyslog, that rsyslog is not currently installed. As I was seeing my VPN logs in syslog earlier, does it mean it was earlier installed? If yes, why would switching from logging#1 to #2 uninstall the rsyslog package. Just curious, shouldn’t the packages be untouched and just the configuration(how and where the logs are saved) be changed.
I went to the “Diet-pi Software” portal → Changes “Log System” from “DietPi-Ramlog #1” to #2 and couldn’t find /var/log/syslog ever since. I also tried flipping it back to #1, but still no syslog.
I was just playing with the settings again, and I saw the following message when switching between "Log System"s:
│ DietPi-Ramlog #2 has been selected: │
│ - Your choice will be applied when ‘Install Go >> Start installation’ is selected. │
│ - Logrotate, Rsyslog installations will be automatically uninstalled.
Not sure, why dietpi needs to uninstall rsyslog or even logrotate at this point. Shouldn’t the only difference between the logsystem #1 and #2 be that the older rotated logs being stored on persistent storage(once at the end of the hour) rather than being discarded hourly.
ok good. Usually rsyslog is not part of the standard image and will be installed if your chose option 3 FULL only.
So probably it was installed by another software before. However, I guess the moment you switched to #2 it was un-installed. Solution would be to go to option 3 FULL or go to install it yourselves.
Thank you again, Joulinar. I am hoping to keep using #2 to save sd card wear but also to persist to storage, hourly. Also to confirm, after installing rysylog, everything was working as expected.