Scheduled time for backups and the space available on the disk

NethServer Version: 7.6.1810
Module: nethserver-backup-data-1.5.0-1.ns7.noarch

Hi all. I have come across a small problem in the GUI.
After the last update of the nethserver-backup module, in the Dashboard, it badly indicates the scheduled time for backups and the space available on the disk.

[root@server ~]# rpm -qa | grep backup
nethserver-automysqlbackup-3.0.RC6-11.ns7.sdl.noarch
nethserver-backup-data-1.5.0-1.ns7.noarch
nethserver-backup-config-2.3.0-1.ns7.noarch
automysqlbackup-3.0.RC6-6.ns7.sdl.noarch

I attached a screenshot.
imagen
Greetings and thanks to all!

EDIT: After the backup is done, it already indicates the available storage, but the correct time still does not appear.
imagen

Well, it is correct :smiley: It uses the cron syntax and means “every day at 3:00”.
Maybe it is not so readable …

Would you like to try to fix it? This is the relevant code: nethserver-backup-data/root/usr/share/nethesis/NethServer/Module/Dashboard/SystemStatus/Backup.php at master · NethServer/nethserver-backup-data · GitHub

2 Likes

Cron syntax works perfectly. But it’s not for human beings…
If this visualization will be used in the future, maybe the contextual-help should explain how It works…
(and sometimes i need a finger-integrated spellchecker…)

1 Like

Hey! Thank you for your answers.

Yes, the scheduled time is fine, what I mean is the format that appears the time. That is, until the last update, it indicated the time programmed in correct format (3:00 for example), as in the end time and not as in the image (0 3 * * *).

1 Like

Hi @giacomo
do u think that this code can work?

$orario = explode(" ",$backup['time']);
      
        function formatOre($h){
	        if(strlen($h)==1){return "0".$h;}else{return $h;}
        }
        
        function formatMin($m){
	         if(strlen($m)==1){return "0".$m;}else{return $m;}
        }
        
        function formatDay($d){
	        switch($d){
		        case 0: return "Sunday";
		        	break;
		        case 1: return "Monday";
		        	break;
		        case 2: return "Tuesday";
		        	break;
		        case 3: return "Wednesday";
		        	break;
		        case 4: return "Thursday";
		        	break;
		        case 5: return "Friday";
		        	break;
		        case 6: return "Saturday";
	        }
        }
        
        if($orario[1] == "*" && $orario[2] == "*" && $orario[3] == "*" && $orario[4] == "*"){
	        $backup['time'] = "Every hour at minute ".formatMin($orario[0]);
        }else if($orario[2] == "*" && $orario[3] == "*" && $orario[4] == "*"){
	        $backup['time'] = "Every day at ".formatOre($orario[1]).":".formatMin($orario[0]);
        }else if($orario[2] == "*" && $orario[3] == "*"){
			$backup['time'] = "Every ".formatDay($orario[4])." at ".formatOre($orario[1]).":".formatMin($orario[0]);
        }else if($orario[3] == "*" && $orario[4] == "*"){
	        $backup['time'] = "Every month on ".$orario[2]." at ".formatOre($orario[1]).":".formatMin($orario[0]);
        }

Probably it can be upgraded with languages settings but I don’t know how they work.

3 Likes

Almost, since there are no translations for the labels.

@davidep could you please take a look when you have little spare time?

2 Likes

Yes of course the patch is welcome. I hope @federico.ballarini wants to open a pull request!

3 Likes

@davidep @giacomo
I opened a pull request: if you can check it.
Thank you so much.

Wait for your feedback.

4 Likes

Thank you in advance for your PR!

Here it is!

2 Likes