On 13/7/21 05:32, Rob Morin wrote:
Hello all...

I was looking at a way to start up my vpn from our remote backup site to the office when backuppc starts a job.

I googled around for quite a bit and saw some people were using  a script in place of the pingcmd parameter.

I have tried that but i cant get it to work, as well as stop the connection when done using the PostDumpCmd.

In a host, where the PingCmd text box is located i entered:
/usr/local/bin/Connect2Office.sh
And made sure the check mark was there and I saved it.

The script itself is below, not much at all, really.

#!/bin/bash
/bin/true
sudo openvpn --daemon --config /etc/openvpn/gateway.hardent.com.ovpn
echo $?

I added the --daemon in order to put the process in the background while running
/bin/true is there because i thought the exit status had to be something
and the echo $? is there for same exit status reason.

The user backuppc is allowed to sudo that script via the sudoers file.

Now , when I manually run this command as the user backuppc or root,  from the command line, all works well, and I can manually start a backup and it completes fine.

However, when I click on the start incremental job from GUI for the same host, as a test, the log file simply shows the below and nothing gets backed up.

2021-07-12 14:49:45 incr backup started back to 2021-07-12 14:33:53 (backup #0) for directory /etc

Then after several minutes of nothing i dequeue the backup and get the below, which is of course normal.

2021-07-12 14:51:26 Aborting backup up after signal INT

I am sure I am doing something stupid....
Any help would be appreciated.

Have a great day!


I'm not sure of using PingCmd for this, but why not use the DumpPreUserCmd http://backuppc.sourceforge.net/faq/BackupPC.html#_conf_dumppreusercmd_ ? The stdout will be sent to the log for you to see what is happening.

As for the script, usually you would run the /bin/true as the last command so that it will ignore any other exit status and always show "successful". So based on the current script, that line is pointless unless you moved it to after the openvpn command.

You might also need to check any capabilities, probably backuppc doesn't have NET_CAP or ability to create tunnels etc, so once you are sure the script is being run (maybe add a touch /tmp/myscript) then you might want to define a openvpn log file so you can see what it is doing and/or why it fails....

You might also need a sleep or some other test to ensure the tunnel is actually working/passing traffic, as openvpn will return before the tunnel is up, and then backuppc will attempt to start the backup.

Regards,
Adam



_______________________________________________
BackupPC-users mailing list
BackupPC-users@lists.sourceforge.net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    https://github.com/backuppc/backuppc/wiki
Project: https://backuppc.github.io/backuppc/

Reply via email to