DEV Community

Discussion on: How to use Node.js to backup your personal files (and learn some webdev skills along the way)

Collapse
 
gabrielski profile image
Gabriel

I always end up with this error: "Backup completed with status code: 1" (I know status 1 is a syntax error or usage). Even with your piece of code, copy/paste, I have the same result.

Suggestions? 🙌

Collapse
 
tkroo profile image
tkroo

I found it helpful to see the rsync command:

// Begin the cronjob
console.log("command:" + rsync.command());
job.start();

Enter fullscreen mode Exit fullscreen mode
Collapse
 
alexeagleson profile image
Alex Eagleson

Verify the command on your terminal outside of the Node app to get more details. If you add console.log(cmd) inside the rsync.execute block it will print out exactly the syntax of the command that it is running in the background, so you can try running it manually.

You can also add the -v flag to get more verbose output to troubleshoot

So for example on the terminal the command using the directories from this tutorial would look like:

rsync -av example-source/ example-destination/
Enter fullscreen mode Exit fullscreen mode

If you find the error and it turns out to be something others might encounter definitely let me know and I'll make an update.