> For the complete documentation index, see [llms.txt](https://docs.copia.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.copia.io/docs/devicelink/basic/fanuc/fanuc-cnc.md).

# FANUC CNC

## Overview

FANUC CNC backups use Copia's [Scripting](https://docs.copia.io/docs/devicelink/basic/copia-scripting.md) integration together with the FANUC FASBacCNC software. This is a coordinated backup between a scheduled backup via FASBacCNC, and a "pickup" of that from Copia.

Please refer to the [FANUC FASBacCNC documentation](https://www.fanucamerica.com/products/cnc/cnc-software/machine-tool-data-collection-software/cnc-data-backup-software-fasbaccnc) for requirements on configuring that software.

{% hint style="info" %}
It will be helpful to have a unique name for the FANUC CNC that you will be backing up. Though not required, it is recommended as a "best practice" and this `{unique_cnc_name}` will be referenced multiple times in the steps below.
{% endhint %}

## Agent Requirements

There are three items to consider when configuring the architecture:

* **Copia Agent**
  * The Copia Agent must have access to the Copia Server (see System Requirements), and also must have access to the files which are backed up via the FANUC FASBacCNC software.
* **FANUC FASBacCNC software**
  * This must be purchased and loaded on a system which provides access for it to backup the CNC(s).
    * If possible, this can be installed on the Copia Agent, as long as it meets the FANUC system requirements.
  * This must be able to store the files in a folder on the Copia Agent, or a folder accessible from the Copia Agent.
* **FANUC CNC**
  * This must be networked for automated backup operation access via FASBacCNC.

<img src="https://3704730939-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4lSQNVI3DZ15V7kjkMCA%2Fuploads%2FJIErUDNpbbNp97FwwJ0h%2Funknown.png?alt=media&amp;token=734c5659-fe5d-4b39-92a6-09ae023b43df" alt="" height="186" width="572">

## FASBacCNC Configuration

1. Install and configure the FANUC FASBacCNC software, per the FANUC product documentation.
2. For each CNC, configure a backup of the CNC to the Copia Agent, in a folder called: `c:\temp\{unique_cnc_name}`
   1. Versioning and Notifications should be disabled in FASBacCNC
   2. Choose a backup period (i.e. daily, weekly, etc)
   3. Choose a time for the backup to occur
3. Test the backup process to ensure that a backup is created appropriately.

## Scripts

This section describes how to create the script. This only needs to be done once per Copia Agent.

1. Create a new text file on the Copia Agent in `c:\copia\scripts\` and rename it `fanuc_cnc.bat`
2. "Edit" the bat file, and enter the text below, then save it

```batch
echo Running FANUC CNC Backup Script...
@echo off
REM -Setup-------------------------------------------------------------
echo %date% %time% Starting FANUC CNC Backup Script >> %temp%\backup_results\CopiaError.log
echo %date% %time% Get Directory Name as Argument >> %temp%\backup_results\CopiaError.log
set DirName=%1
echo %date% %time% DirName is: %DirName% >> %temp%\backup_results\CopiaError.log
REM echo %date% %time% Copy Backup Script into Results >> %temp%\backup_results\CopiaError.log
echo %date% %time% Running Backup Script >> %temp%\backup_results\CopiaError.log

REM -Script------------------------------------------------------------
xcopy c:\temp\%dirName% %temp%\backup_results /e
REM -Cleanup and Exit--------------------------------------------------
echo %date% %time% Completed Backup Command >> %temp%\backup_results\CopiaError.log
for /d %%i in ("c:\temp\%DirName%\*") do rd /s /q "%%i"
REM -Remove Error Log = It worked!-------------------------------------
del %temp%\backup_results\CopiaError.log
exit
```

## Project Configuration

It is assumed you have already done the following:

* Created a [Copia Repository](https://docs.copia.io/docs/git-based-source-control/basic/create-a-new-repository/create-a-new-repository.md) for the CNC backup files.
* Created a [DeviceLink Site](https://docs.copia.io/docs/devicelink/sitesandagents/sites.md) in Copia for the CNC backup.
* Configured a [Copia Agent](https://docs.copia.io/docs/devicelink/sitesandagents/agents.md) to perform the backups.

If not, please refer to the Copia documentation using the provided links to complete these tasks prior to moving forward.

{% hint style="info" %}
The folder can be created during the project creation process.
{% endhint %}

Click either of the *Add a Project* buttons in the Projects tab.

<img src="https://3704730939-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4lSQNVI3DZ15V7kjkMCA%2Fuploads%2FGLIppKU06Oi2cXE3EdCz%2Funknown.png?alt=media&amp;token=f35093d4-b469-41aa-901d-84e86d5f6e0b" alt="" height="249" width="484">

The *Add a new project* configuration dialog will appear which allows you to fully configure the project, devices and job for the project.

{% hint style="info" %}
The project can be edited after creation. Devices and Jobs can also be edited or created directly, using the Devices or Jobs tab. The steps for creation are similar to the steps provided below for those sections.
{% endhint %}

#### Define the Project

To get started, select **Script** as the *Project Type*, and then select your *Agent* (`{copia_agent_name}`). See more about this in the [Agents](https://docs.copia.io/docs/devicelink/sitesandagents/agents.md) section of the documentation.

When complete, press *Save and Continue*.

You will now select the Project Path, which is the location (Repo/Branch) that the project is, or will be stored.

1. Select the repository and branch (*typically "main"*) that you created for your project, and check "Create and select a new directory…"
2. Name the directory (*folder*) the same as your `{unique_cnc_name}`

Once complete, press *Save and Continue* to proceed.

The project details allows you to update the Project name, and description if desired.

* **Project Name:** `{unique_cnc_name}`
* **Description:** {optional}
* **Script Path:** `c:\copia\scripts\fanuc_cnc.bat {unique_cnc_name}`
* **File List:** {*use existing if already completed*}
  * If you have not yet created a FANUC\_CNC [File List](https://docs.copia.io/docs/devicelink/sitesandagents/sites/file-lists.md), click *Create a Filelist*, and create/save the details.
  * Return to the prior tab, and select the new File List.

<img src="https://3704730939-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4lSQNVI3DZ15V7kjkMCA%2Fuploads%2FWVTs6gkMmyyyqZQ8RMZI%2Funknown.png?alt=media&amp;token=2a883c45-2629-467d-9661-1dabdb3ce78c" alt="" height="235" width="397">

#### Define the Device

Since the Script exists on the Agent, there is no need to define a Device for Projects that use a Script during setup. You can skip to the Job section.

#### Define the Job

Creating Jobs is similar for all vendor types, and is described in the [Creating Jobs](https://docs.copia.io/docs/devicelink/jobs/creating-jobs.md) section. It is recommended to review that section while completing a job configuration, and press Save to save the job.

For FANUC CNC jobs:

1. Choose a period that matches the backup period set in FASBacCNC Configuration
2. Choose a time that gives enough time for the FASBacCNC software to complete the backup (*i.e. if it is scheduled for 1pm, and it takes 5 minutes, choose 1:10pm…then set the next CNC to backup starting at 1:15pm*)
3. Pick "Choose existing branch", and select the branch selected in [Define the Project](#define-the-project)

#### Submit the Configuration

Once complete, press *Submit Project Setup* to create the Project, Device(s) and Job(s).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.copia.io/docs/devicelink/basic/fanuc/fanuc-cnc.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
