smartsheet-platform / backup-java

A simple command-line based backup tool for backing up an organization's Smartsheet data.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Automating the batch file

kluke43 opened this issue · comments

Greetings,

I have been assigned the task to backup the smartsheet data for our team. I created a folder on my C: drive called SSBackup. I gave Everyone permission on this folder as part of troubleshooting. Within the folder are three files: smartsheetbackup.bat, smartsheet-backup.properties, and smartsheet-org-backup-1.6.1.jar.

The batch file is as follows:
"C:\Program Files (x86)\Java\jre7\bin\java.exe" -jar C:\SSBackup\smartsheet-org-backup-1.6.1.jar

The properties is as follows:
accessToken=*******************//accessToken removed for security purposes for this post
outputDir=Z: //This is a shared drive I created to point to a server location to place the zip file

continueOnError=true

zipOutputDir=true

downloadThreads=4

allDownloadsDoneTimeout=24

I didn't touch the .far file as that houses the API required to make the magic work.

The script works wonderfully if I run it while logged in locally as any user. The problem is when I try to schedule a task on the server to run the batch file. I've done this tons of times and can't seem to figure out why it won't work. I also use my RMM tool to run batch files such as this one and I get the following output from that:

C:\SSBackup\smartsheetbackup.bat
java.io.FileNotFoundException: File not found: C:\Windows\system32\smartsheet-backup.properties
at com.smartsheet.tools.SmartsheetBackupTool.readPropertiesFile(SmartsheetBackupTool.java:180)
at com.smartsheet.tools.SmartsheetBackupTool.main(SmartsheetBackupTool.java:74)

C:\Windows\system32>"C:\Program Files (x86)\Java\jre7\bin\java.exe" -jar C:\SSBackup\smartsheet-org-backup-1.6.1.jar
_ERROR_ FileNotFoundException - File not found: C:\Windows\system32\smartsheet-backup.properties

I've reached out to support and they basically pointed me to this forum. Can anyone help me figure out why this is happening? I also made a copy of the properties file and moved it to C:\Windows\system32\ in a desperate effort to no avail.

Thanks,
kluke

Hi kluke,

This isn't an officially supported tool, but at quick glance, it looks like you need to make sure your properties file is located C:\Windows\system32\smartsheet-backup.properties and that the user running the script has access to read that file. Or, instead, put the properties file in your C:\SSBackup directory, cd to that directory instead of the system32 one and run
"C:\Program Files (x86)\Java\jre7\bin\java.exe" -jar smartsheet-org-backup-1.6.1.jar from there. It should pick up your properties file from the working directory.

Hopefully that helps!