Solved Running Backups From Debian Command Line - Should we stop services?

Status
Not open for further replies.

Alan Figgins

Free User
Joined
Jan 27, 2019
Messages
56
Reaction score
3
Hi All,

I have a client that wants to run backups from the command line (separate from the ones scheduled in 3CX itself).

This is a very standard setup on the current 3CX Debian ISO.

I ran a backup using these commands:

Code:
cd /var/lib/3cxpbx/Instance1/Bin/

sudo -u phonesystem /usr/sbin/3CXBackupCmd --file=YYYYMMDD-HHMM-3CX_Backup_All.zip --options=ALL --log=/tmp/YYYYMMDD-HHMM-3CX_Backup_All.log

which seemed to run okay from the terminal screen, but when I checked the log file, it contains the lines I have quoted at the bottom of this post.

I figured perhaps it was because 3CX was running, so I stopped all the 3CX Services:

Code:
systemctl stop 3CX*.Service

and then re-ran the above command to backup, but it just sat there doing nothing.

Can anyone advise if I am doing something wrong?

Thanks,

Alan.

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Log file - truncated - end only, which shows all the exceptions:


2019/07/30 13:51:23.196|2093|0001|Info|Sending email about backup is succeeded
2019/07/30 13:51:23.362|2093|0001|Excpt|System.AggregateException: One or more errors occurred. (Resource temporarily unavailable) ---> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException: Resource temporarily unavailable
at System.Net.Dns.InternalGetHostByName(String hostName)
at System.Net.Dns.ResolveCallback(Object context)
--- End of stack trace from previous location where exception was thrown ---
at System.Net.Dns.HostResolutionEndHelper(IAsyncResult asyncResult)
at System.Net.Dns.EndGetHostAddresses(IAsyncResult asyncResult)
at System.Net.Sockets.Socket.DoDnsCallback(IAsyncResult result, MultipleAddressConnectAsyncResult context)
at System.Net.Sockets.Socket.DnsCallback(IAsyncResult result)
--- End of stack trace from previous location where exception was thrown ---
at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
at MailKit.Net.SocketUtils.ConnectAsync(String host, Int32 port, IPEndPoint localEndPoint, Boolean doAsync, CancellationToken cancellationToken)
at MailKit.Net.SocketUtils.ConnectAsync(String host, Int32 port, IPEndPoint localEndPoint, Int32 timeout, Boolean doAsync, CancellationToken cancellationToken)
at MailKit.MailService.ConnectSocket(String host, Int32 port, Boolean doAsync, CancellationToken cancellationToken)
at MailKit.Net.Smtp.SmtpClient.ConnectAsync(String host, Int32 port, SecureSocketOptions options, Boolean doAsync, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait(TimeSpan timeout)
at TcxMail.Mail.SmtpConnect(SmtpClient smtpClient)
at TcxMail.Mail.Send(AlternateView calendarData)
at _3cxBackupRestoreImpl.BackupRestoreUtils.NotifyBackupFailed(String file, IEnumerable`1 exceptions)
---> (Inner Exception #0) System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (00000001, 11): Resource temporarily unavailable
at System.Net.Dns.InternalGetHostByName(String hostName)
at System.Net.Dns.ResolveCallback(Object context)
--- End of stack trace from previous location where exception was thrown ---
at System.Net.Dns.HostResolutionEndHelper(IAsyncResult asyncResult)
at System.Net.Dns.EndGetHostAddresses(IAsyncResult asyncResult)
at System.Net.Sockets.Socket.DoDnsCallback(IAsyncResult result, MultipleAddressConnectAsyncResult context)
at System.Net.Sockets.Socket.DnsCallback(IAsyncResult result)
--- End of stack trace from previous location where exception was thrown ---
at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
at MailKit.Net.SocketUtils.ConnectAsync(String host, Int32 port, IPEndPoint localEndPoint, Boolean doAsync, CancellationToken cancellationToken)
at MailKit.Net.SocketUtils.ConnectAsync(String host, Int32 port, IPEndPoint localEndPoint, Int32 timeout, Boolean doAsync, CancellationToken cancellationToken)
at MailKit.MailService.ConnectSocket(String host, Int32 port, Boolean doAsync, CancellationToken cancellationToken)
at MailKit.Net.Smtp.SmtpClient.ConnectAsync(String host, Int32 port, SecureSocketOptions options, Boolean doAsync, CancellationToken cancellationToken)<---
 
When you backup from the management console the services aren't stopped. No need to stop it for command line as it's the same thing.
 
Hi cobaltit,

When you backup from the management console the services aren't stopped. No need to stop it for command line as it's the same thing.

Thanks for your rapid reply.

That was my first inclination (not to stop anything), and is what I did (I left it all running as normal, and just ran the backup), but I got all those exception errors at the end of the log file (see bottom of my first post).

Are you able to advise what, if anything, they mean?

Thanks,

Alan.
 
No clue. I'd run a command line one and then a management console one and then compare the ZIP files. If they match up then it's probably just noise, albeit disconcerting noise. I'll jump on a system right now and run a backup and see what the logs look like.
 
So it looks like your machine is having trouble looking up the SMTP server to send the email. The last line in my backup log is:

Code:
2019/07/29 23:02:56.983|14855|0001|Info|Sending email about backup is succeeded

I'd run the SMTP test and make sure that is working.
 
Hi cobaltit,

So it looks like your machine is having trouble looking up the SMTP server to send the email. The last line in my backup log is:

Code:
2019/07/29 23:02:56.983|14855|0001|Info|Sending email about backup is succeeded

I'd run the SMTP test and make sure that is working.

Mea culpa

I had disabled networking while I ran the backup, so that, for example, a caller wasn't leaving a message at the same time, since I did not want anything to be in use while the backup ran.

The errors will (presumably) all have been due to the lack of connectivity that the server had (or did not have) at the time.

Sorry for that - I out-smarted myself!


Thanks for your assistance and helping me work it out.

Alan.
 
Hi Alan,

Glad it was sorted out. Just commenting that the services indeed do not need to be stopped, that would actually prevent the backup from completing since it relies on the services (Management Console)
 
Hi JohnS_3CX,

Got it :-)

Not sure if I should start a new thread for this, but it is related.

The client is happy to be able to backup 3CX like the above, but they also require the ability to periodically create an image of the server.

Their preference is to use either dd or ddrescue.

Their approach is that, if the server 'dies' then they would replace the hardware, restore the dd image, then restore the 3CX backup, all without requiring any access to the 3CX console.

Once that is done, they would reboot, and the phone system should be up and running (minus any config changes and, for example, voicemails that were left after the backup was last run, so max of 24 hours of 'loss').

That's all sounding fine to me, but do they need to take the Debian server down, and boot from a 'live disk' to run the dd backup? I assume so, but maybe I am wrong? If so, then the phone system would need to be down for some time (maybe hours - not sure) while the image is created.

Now, that might be okay if they are only imaging once every few months (say), but I just wanted to check, and also ask what others here do in this respect?

Thanks,

Alan.
 
Best start a new thread on the imaging part
 
Status
Not open for further replies.

Forum statistics

Threads
111,933
Messages
589,809
Members
164,807
Latest member
Smax