Skip to content
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

database-backup-and-maintenance.sh creates output on success #1415

Closed
tribut opened this issue Apr 22, 2016 · 10 comments
Closed

database-backup-and-maintenance.sh creates output on success #1415

tribut opened this issue Apr 22, 2016 · 10 comments

Comments

@tribut
Copy link
Contributor

tribut commented Apr 22, 2016

Because /etc/cron.d/packetfence runs database-backup-and-maintenance.sh, a mail is generated every night even if no errors occured. Example output:

/root/backup/ , folder already created. 

tar: Removing leading `/' from member names
tar: /usr/local/pf/var/run/radiusd.sock: socket ignored
tar: /usr/local/pf/var/run/pfconfig.sock: socket ignored
tar: /usr/local/pf/var/run/radiusd-load_balancer.sock: socket ignored
tar: /usr/local/pf/var/run/redis_cache.sock: socket ignored
tar: /usr/local/pf/var/run/collectd-unixsock: socket ignored
tar: /usr/local/pf/var/run/radiusd-acct.sock: socket ignored
tar: /usr/local/pf/var/run/redis_queue.sock: socket ignored
packetfence-files-dump have been created in  /root/backup/ 

packetfence-files-dump older than 30 days have been removed. 

Apr 22 00:31:22 : Deleting 0 entries from locationlog in 1 runs batching 500 at the time waiting 0.5     seconds between runs. 
Apr 22 00:31:23 : Deleting 0 entries from iplog_history in 1 runs batching 500 at the time waiting 0.5 seconds between runs. 
Apr 22 00:31:24 : Deleting 0 entries from radacct in 1 runs batching 500 at the time waiting 0.5 seconds between runs. 
Apr 22 00:31:25 : Deleting 0 entries from radacct_log in 1 runs batching 500 at the time waiting 0.5 seconds between runs. 
Apr 22 00:31:26 : Deleting 0 entries from auth_log in 1 runs batching 500 at the time waiting 0.5 seconds between runs. 
Apr 22 00:31:27 : Deleting 0 entries from radius_audit_log in 1 runs batching 500 at the time waiting 0.5 seconds between runs. 

(Also see #1404)

@dwlfrth
Copy link
Contributor

dwlfrth commented Apr 22, 2016

Hello @tribut
How is this "an issue" ?
That's the standard behavior of cron to send a "report" once a task is completed.
You could append "> /dev/null" at the end of the command lines you don't want to receive the output.

@tribut
Copy link
Contributor Author

tribut commented Apr 22, 2016

Are you saying it's intended behavior that a cron job which is installed by default generates a mail every night?
Because cron generates a mail if any output occurs, cronjobs normally use something like a --quiet option where only error messages are printed. And I would argue that is "the right thing to do".

@dwlfrth
Copy link
Contributor

dwlfrth commented Apr 22, 2016

Well, from what I know (I may be wrong, it sometimes happens ;)), by default cron jobs sends a email to the user account executing the cronjob if there's an error or of the job generates an output.

The following "> /dev/null" will discard any output from the job (which means, no email) but a mail will be sent in the case something is going to stderr ...

@louismunro
Copy link
Contributor

I think the issue is one of expectations.
We can certainly force the cron job to be quiet.
But then how will the user know that the backups are running?
Admittedly that is what logs are for.

I am inclined to side with @tribut

@tribut
Copy link
Contributor Author

tribut commented Apr 22, 2016

@dwlfrth True, but tar writes its warnings to stderr, so >/dev/null would not be enough to silence the cronjob, while 2>&1 /dev/null would also prevent errors from being sent out.

@julsemaan
Copy link
Collaborator

Well the errors are sockets being backed up in /usr/local/pf/var/run
No need to backup the content of that directory as it contains PID files and sockets that can't be restored anyway.

So silencing tar and mkdir should do it, and the cleanup will be moved out of that in 6.1 anyway

@julsemaan
Copy link
Collaborator

The var/run isn't part of the tar anymore so the sockets message should be gone.

I still believe we should keep the remaining of the output so we know what happened

My 2 cents. Lets see if others who disagrees

@dwlfrth
Copy link
Contributor

dwlfrth commented Oct 17, 2016

Let's see as @julsemaan says.
Also probably going to retire that script sooner or later...

@julsemaan
Copy link
Collaborator

Lets give some love to that script in 8.1

@julsemaan julsemaan added this to the PacketFence-8.1 milestone Apr 5, 2018
@julsemaan julsemaan removed this from the PacketFence-9.1 milestone Apr 15, 2022
Yannik added a commit to Yannik/packetfence that referenced this issue Jul 11, 2023
…ce.sh (fixes inverse-inc#1415)

This fix removes the "tar: Removing leading `/' from member names" output which otherwise occurs on every run
@Yannik
Copy link
Contributor

Yannik commented Jul 11, 2023

I have opened #7754 to remove the stderr output generated by tar. This should be a major step forward in this. Together with chronic, cron emails can now be suppressed for all non-error cases.

@fdurand fdurand closed this as completed in 132ad79 Jan 5, 2024
satkunas pushed a commit that referenced this issue Jan 11, 2024
…ce.sh (fixes #1415)

This fix removes the "tar: Removing leading `/' from member names" output which otherwise occurs on every run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants