BIM Coordinator Program (INT) April 22, 2024

Find the next step in your career as a Graphisoft Certified BIM Coordinator!

Teamwork & BIMcloud
About Teamwork, BIMcloud, BIMcloud Basic, BIMcloud Software as a Service, network settings, etc.

Backupscript

Anonymous
Not applicable
Hi there,
This is maybe a little bit of topic, but also not. So I'll give it a try.

First question:
When running the "TeamworkServerBackupTool" from terminal, it outputs how successful the backup went.
I was wondering, how can I add this in a shell script (bash) so it sends me a mail with this info after every run? I know the syntax for sending the mail, but how do I redirect the standard output so it will be included in the e-mail?

Also, in the provided example in the Backup user guide from Graphisoft, there is a shell script for backup. But I would like to add to this script so that it sends me an e-mail telling me if the ServerDaemon and the ManagerDaemon has successfully started again. How do I add this to the mail? Any pointer on how to achieve this?

This is my current script so far. I'm doing a backup of the whole manager and server and using the "TeamworkServerBackupTool". Let's just say that we what both backups.

____________________________________________________________________

#!/bin/bash

# Adjust path for the below components. Projects, Libraries and Manager Data folders can be in special locations!
ManagerDir="/Applications/GRAPHISOFT/BIMcloud/Manager-2018-10-11-3"
ManagerDataDir="/Applications/GRAPHISOFT/BIMcloud/Manager-2018-10-11-3/Data"
ServerDir="/Applications/GRAPHISOFT/BIMcloud/Server-2018-10-11-3"
ProjectDir="/Applications/GRAPHISOFT/BIMcloud/Server-2018-10-11-3/Projects"
LibraryDir="/Applications/GRAPHISOFT/BIMcloud/Server-2018-10-11-3/Attachments"
localBkUp="/Volumes/Test/BACKUPTEST"
ManagerDaemon="/Library/LaunchDaemons/com.graphisoft.PortalServerService-v22.0(Manager-2018-10-11-3).plist"
ServerDaemon="/Library/LaunchDaemons/com.graphisoft.TeamworkApplicationServerMonitor-v22.0(Server-2018-10-11-3).plist"

# Editing the script below this line is not necessary!

# Checking if BIMcloud Basic or the backup folder does not exist
if [[ ! -d ${ManagerDir} ]] || [[ ! -d ${ServerDir} ]] ; then
echo "BIMcloud Basic does not exist"
exit 1
elif [[ ! -dw ${localBkUp} ]] ; then
echo "${localBkUp} folder does not exist or the folder is not writable"
exit 1
fi

# Cleaning the backup folder
rm -rf "${localBkUp}/Manager"
rm -rf "${localBkUp}/Server"
rm -rf "${localBkUp}/Single-Restore"

# Creating folders for the Backup
mkdir -pv "${localBkUp}/Manager"
mkdir -pv "${localBkUp}/Server"
mkdir -pv "${localBkUp}/Single-Restore"

# Checking if the subfolders cannot be created
if [[ ! -dw "${localBkUp}/Manager" ]] || [[ ! -dw "${localBkUp}/Server" ]] ; then
echo "The subfolders in ${localBkUp} cannot be created or the folders are not writable"
exit 1
fi

# Stopping Server and Manager
launchctl unload "${ServerDaemon}"
launchctl unload "${ManagerDaemon}"

# Copying the Manager's data
cp -R "${ManagerDir}/Config" "${localBkUp}/Manager"
cp -R "${ManagerDataDir}" "${localBkUp}/Manager"

# Restarting Manager service while copying files for Server so it has time to start properly
launchctl load "${ManagerDaemon}"

# Copying the Server's data
cp -R "${LibraryDir}" "${localBkUp}/Server"
cp -R "${ServerDir}/Config" "${localBkUp}/Server"
cp -R "${ServerDir}/Mailboxes" "${localBkUp}/Server"
cp -R "${ProjectDir}" "${localBkUp}/Server"
cp -R "${ServerDir}/Sessions" "${localBkUp}/Server"

# Start the BackupTool and create project resotre files. Will create BIMProject and BIMLibrary files
/Applications/GRAPHISOFT/BIMcloud/Server-2018-10-11-3/TeamworkServerBackupTool /Volumes/Test/BACKUPTEST/Single-Restore

# Restarting Server service
launchctl load "${ServerDaemon}"

echo "Backup complete" | mail -s "Backupstatus" mail@mail.com
0 REPLIES 0
Learn and get certified!

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!