Backup script

Status
Not open for further replies.

555NASE

Patron
Joined
Mar 3, 2017
Messages
202
Hallo, I have write my first backup script for my FreeNas.
I want to run this as a cronjob.

I have add a New Task

Screenshot-2017-10-25 freenas - FreeNAS-11 0-U4 (54848d13b).png

/bin/bash /mnt/Volume1/Medien/backup.sh


The backup.sh has the following script:


Code:
#!/bin/bash

#Variablen festlegen (immer beginnend und endend mit / )
############################
now=$(date +"%Y_%m_%d")
source=/mnt/Volume1/Daten_Bastian
target=/mnt/Volume1/Daten_Bastian/aaaaaa
#############################


#Kopiervorgang
############################
cp -a $source $target/$now.backup
############################


Now when I start the Script on Console I get the following Error:



The Path "mnt\Volume1\Daten_Bastian" are not exist.



Can anyone help me?
 

Attachments

  • 2017-10-25 18_27_28-Create Thread _ FreeNAS Community.jpg
    2017-10-25 18_27_28-Create Thread _ FreeNAS Community.jpg
    20 KB · Views: 186
Last edited:

IceBoosteR

Guru
Joined
Sep 27, 2016
Messages
503
When I am looking at the output, is says that /mnt/Volume/Daten_Bastian does not exist. In your little script you want to copy to
/mnt/Volume1/Daten_Bastian/aaaaaa
So, ist vol1 correct? If the path may not be correct try it with "/mnt/path..." do stick it a string-defined variable.

You can also try to open a new shell, propably just writing bash or ksh whatever, enter the varibles manually, then execute the script manually, that is easy debugging. Or set "set -x" after calling the bash, so the bash will show you everything it is doing so you can debug. More you can read here.
 
Status
Not open for further replies.
Top