Debian 8 backups not working

Status
Not open for further replies.

AverageGuy

New Member
Jun 18, 2017
25
0
1
Atlanta, GA metro
I discovered a problem with the backup solution described at https://fusionpbx-docs.readthedocs.io/en/latest/getting_started/backup.html#crontab for crontab. The files in /etc/cron.daily will not run if they have an extension. Or at least they won't run with and extension of .sh, which means that fusion-backup.sh and fusion-maintenance.sh will not run. When I removed the .sh they worked correctly. Since my Debian installation is pretty plain vanilla I assume I didn't do anything to cause this.
 

AverageGuy

New Member
Jun 18, 2017
25
0
1
Atlanta, GA metro
Because someone challenged the above statement. I did some research. From the run-parts man page I found this:
" run-parts runs all the executable files named within constraints described below, found in directory directory. Other files and directories are silently ignored.

If neither the --lsbsysinit option nor the --regex option is given then the names must consist entirely of ASCII upper- and lower-case letters,ASCII digits, ASCII underscores, and ASCII minus-hyphens."


The implication is that file names containing other than the "permitted" characters will be ignored which is in fact my experience.

cat /etc/issue
Debian GNU/Linux 8 \n \l

Respectfully,
Jim.
 

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,044
565
113
I can't swallow this either. If you are referring to the command:

Code:
0 0 * * * /bin/sh /etc/cron.daily/fusionpbx-backup.sh

The above should definitely execute and run.

The real head scratcher for me though is what the hell it is doing in /etc/cron.daily as the patch could be anywhere.

Now that file sat inside cron.daily may well not execute as a cron run part but the point is, this is being added with crontab -e which should just have it running from the root cron. cron.daily etc should play no part.
 

AverageGuy

New Member
Jun 18, 2017
25
0
1
Atlanta, GA metro
I can't swallow this either. If you are referring to the command:

Code:
0 0 * * * /bin/sh /etc/cron.daily/fusionpbx-backup.sh

The above should definitely execute and run.

The real head scratcher for me though is what the hell it is doing in /etc/cron.daily as the patch could be anywhere.

Now that file sat inside cron.daily may well not execute as a cron run part but the point is, this is being added with crontab -e which should just have it running from the root cron. cron.daily etc should play no part.
It runs fine as fusionpbx-backup.

Oh well,
Thanks,
Jim.
 

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,044
565
113
I little further digging into this and it just seems that the FusionPBX documentation is wrong.

The job in cron.daily should never be run from crontab as this would result in it being ran twice, once from the schedulae set for the crontab and also once as the cron.daily part. It does look, however, as pointed out above, that there should be no extension for something in cron.daily.
 

markjcrane

Active Member
Staff member
Jul 22, 2018
448
162
43
49
So limitation mentioned for not using .sh in the filename is only for automatic use of cron.daily. This is okay but if you want to control when its being done its seems cron.daily automatically is not ideal.

Question then is where is a better place to put it. fusionpbx.backup.sh will work fine with contab -e from any location. It could be run from the root directory this would work.

However it would seem that there has to be a better location to put it. /etc/cron.daily seemed to hint that it was used for cron on a daily basis having it run it daily but a controlled time I think is better. Example if the server time is UTC and you don't live near UTC having it run at midnight could be during working hours in many parts of the world. So controlling when it is run is important.
 

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,044
565
113
Yep, agreed, the location looks wrong and if it didn't have the extension, it would run twice. I run all my stuff out of crontab -e.

I don't know linux enough to know where it should live, maybe even /usr/local/sbin??

A quick look on stack exchange shows this answer as the upvoted one:

Code:
Typically, I put mine in:


/usr/local/bin/ for scripts to be run by more than one normal user
/usr/local/sbin/ for scripts which are to be run as root

That way you separate the task that the script does, from cron which just automates launching it.

You'll need root to store files there, though.
 
Status
Not open for further replies.