Last active
June 17, 2022 01:44
-
-
Save henri/53d0b69dd5e731b05186bad12b035521 to your computer and use it in GitHub Desktop.
P5 Backup2Go Command Line Cheat Sheet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Archiware Cheat Sheet - Backup2Go | |
# These are some useful commands which I stumbled upon while setting up automatic P5 configurarions | |
# web interface URL | |
http://127.0.0.1:8000/lexxapp/login?u_app=client | |
# start backup (from client) - depending on which server you wish to initate a backup with you may need to change this | |
/usr/local/aw/bin/nsdchat -c Server 10001 start now | |
# stop the deamon | |
/usr/local/aw/stop-server | |
# start the deamon | |
/usr/local/aw/start-server | |
# connect to server (from client) | |
/usr/local/aw/bin/nsdchat -c Server configure <backup-server-host-name> <port> <backup-user> <backup-password> <backup-template> | |
eg : /usr/local/aw/bin/nsdchat -c Server configure mybackupserver.mydomain.com 20000 mrbackup super!secr3ts 1000 | |
# removes deleted workstation records on the server and all references to deleted workstation's snapshots | |
# it will leave the data (files and folders) in the B2Go repository. | |
nsdchat -c Backup2Go cleanup | |
# removes deleted workstation records on the server and all references to deleted workstation's snapshots | |
# also removes the files and folders from the B2Go repository. | |
nsdchat -c Backup2Go cleanup snapshots trashes | |
# change user password (newer versions of P5 B2Go. | |
/usr/local/aw/bin/nsdchat -c User <username> password <newpassword> <oldpassword> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# (C) 2013 Henri Shustak | |
# Licenced under the Apache Licence | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# This script is a part of an example packge build sub system which is bunlded with Total Configuration : | |
# http://lucid.systems/tools/osx/total_configuration | |
# Usage : | |
# | |
# Create the following directory / file structure | |
# - > myproject (top level directroy) | |
# - - > build.bash (this build script) | |
# - - > root (directory) | |
# - - > scripts (directory | |
# - - - > installation_components (directory) | |
# - - - - - > P5-Workstation-5.6.4-Install.pkg (download the latest installer for P5 Workstations) | |
# - - - > InstallPKG (download from : http://wwww.henri.shustak.org/tools/installpkg) | |
# - - - > P5-Uninstall.app (optional) | |
# - - - > postinstall (p5-backup2go-client-connect-example.bash - rename it) | |
# | |
# Run the build.bash script (you may need to make it executable - chamod +x build.bash | |
# | |
# If you require a signed package as output, then you will want to modify this script to include packagebuild signing | |
# Example build script | |
# version 1.0 - initial release | |
# version 1.1 - minor updates | |
# Notes : | |
# If you have no payload for your package then --nopayload may be a good option to specify. | |
# User varibales | |
package_identifier="com.mydomain.backup-p5" | |
package_version="1.0" | |
package_output_name="backup-p5.pkg" | |
# Intenral variables | |
exit_status=0 | |
parent_directory="`dirname \"${0}\"`" ; if [ "`echo "${parent_directory}" | grep -e "^/"`" == "" ] ; then parent_directory="`pwd`/${parent_directory}" ; fi | |
temporary_build_directory=`mktemp -d /tmp/p5_build_directory.XXXXXXXXXXXXX` | |
realitve_package_output_directory="build_output/`date \"+%Y-%m-%d_%H.%M.%S\"`" | |
absolute_path_to_package_build_directory="${parent_directory}/${realitve_package_output_directory}" | |
absolute_path_to_package_build="${absolute_path_to_package_build_directory}/${package_output_name}" | |
realitve_postinstall_script_diectory_name="scripts" | |
function clean_exit { | |
cd / | |
rm -Rf "${temporary_build_directory}" | |
exit ${exit_status} | |
} | |
# change directory to the temporary build directory | |
cd "${temporary_build_directory}" | |
if [ $? != 0 ] ; then echo "ERROR! : Unable to swtich to temporary build directory." ; exit_status=1 ; clean_exit ; fi | |
# populate temporary build directory with approriate files | |
rsync -aE --exclude="/build_output" "${parent_directory}/" "./" | |
if [ $? != 0 ] ; then echo "ERROR! : Unable to copy files to temporary build directory." ; exit_status=1 ; clean_exit ; fi | |
# generate build output directory | |
echo $absolute_path_to_package_build_directory | |
mkdir -p "${absolute_path_to_package_build_directory}" | |
if [ $? != 0 ] ; then echo "ERROR! : Unable to generate output build directory." ; exit_status=1 ; clean_exit ; fi | |
# build that package | |
pkgbuild --identifier ${package_identifier} --version ${package_version} --root ./root --scripts ./scripts --install-location / "${absolute_path_to_package_build}" | |
# Remove the odd directory if it shows up. | |
if [ -d "${absolute_path_to_package_build_directory}/(A Document Being Saved By pkgbuild)" ] ; then rmdir "${absolute_path_to_package_build_directory}/(A Document Being Saved By pkgbuild)" ; if [ $? != 0 ] ; then echo "ERROR! : Unable to remove the \"(A Document Being Saved By pkgbuild)\" directory." ; exit_status=1 ; clean_exit ; fi ; fi | |
clean_exit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Version 1.1 | |
# Note : This script will delete the client settings on the machine. | |
# This will result in the removal of servers which may have been configured in the past. | |
# example script which will connect up to the server. | |
# Copyright 2016 - Henri Shustak | |
# Released under the MIT Licence : https://opensource.org/licenses/MIT | |
#configuration - add your server details into this spot | |
SERVERNAME="mybackupserver.mydomain.com" | |
SERVERPORT="20000" | |
USERNAME="mrbackup" | |
PASSWORD="super!secr3ts" | |
TEMPLATE="1000" | |
#configure path | |
PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/lib | |
# script parent directory | |
parent_directory_path=`dirname "$0"` | |
cd "${parent_directory_path}" | |
if [ $? != 0 ] ; then | |
echo “ERROR! : Unable to switch to this scripts parent directory.” | |
exit -128 | |
fi | |
sleep 5 | |
sync | |
# stop the P5 server | |
if [ -e /usr/local/aw/ ] ; then sudo /usr/local/aw/stop-server ; fi | |
# remove configruarion | |
if [ -e "/usr/local/aw/config/customerconfig/resources.db" ] ; then | |
sudo rm -Rf "/usr/local/aw/config/customerconfig/resources.db" | |
if [ $? != 0 ] ; then | |
echo "ERROR! : Unable to remove local configuration" | |
exit -129 | |
fi | |
sleep 1 | |
sync | |
fi | |
#install installpkg | |
installer -pkg ./InstallPKG.pkg -target / | |
if [ $? != 0 ] ; then | |
echo “ERROR! : Unable to install installpkg onto this system.” | |
exit -128 | |
fi | |
sleep 2 | |
#install P5 | |
installpkg ./installation_components/* | |
if [ $? != 0 ] ; then | |
echo “ERROR! : Unable to install P5 Workstation onto this system.” | |
exit -128 | |
fi | |
# start P5 server | |
if [ -e /usr/local/aw/ ] ; then sudo /usr/local/aw/start-server ; fi | |
sleep 10 | |
sync | |
# configure p5 | |
/usr/local/aw/bin/nsdchat -c Server configure ${SERVERNAME} ${SERVERPORT} ${USERNAME} ${PASSWORD} ${TEMPLATE} | |
exit_status=${?} | |
# Stop the P5 server | |
if [ -e /usr/local/aw/ ] ; then sudo /usr/local/aw/stop-server ; fi | |
sleep 10 | |
# start P5 server | |
if [ -e /usr/local/aw/ ] ; then sudo /usr/local/aw/start-server ; fi | |
sync | |
sleep 20 | |
/usr/local/aw/bin/nsdchat -c Server 10001 start now | |
exit $exit_status |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# (C) 2013, Henri Shustak - MIT LICENCE | |
# This script is desinged to work with ArchiWare (AKA P5 Backup) | |
# This is a script to check a workstation for the last succesfull backup - you may need to select a differnt ID | |
# This is a pre-production script needs more work but you would be able to setup push notifications / emails etc | |
# When the backup has not been completed in a certian ammount of time. | |
require 'time' | |
@current_ruby_time = Time.parse(`date`) # alterantivly you could use 'Time.now' | |
@max_number_of_seconds_since_previous_backup_successully_completed = "604800" # 86400 seconds is one day. 604800 is one week. | |
@last_succesfull_backup = `/usr/local/aw/bin/nsdchat -c Workstation 10001 lastend` | |
puts @current_ruby_time.to_i | |
puts @max_number_of_seconds_since_previous_backup_successully_completed | |
puts @last_succesfull_backup | |
@number_of_seconds_since_succesful_last_backup = @current_ruby_time.to_i - @last_succesfull_backup.to_i | |
puts @number_of_seconds_since_succesful_last_backup | |
#puts DateTime.strptime("#{@last_succesfull_backup}",'%s').strftime("%d %m %y") | |
puts `date -r #{@last_succesfull_backup}` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment