Saving .db config

Status
Not open for further replies.

Jacopx

Patron
Joined
Feb 19, 2016
Messages
367
Hi, i have just update to the latest version (FreeNAS-9.10-STABLE-201603252134 (412fb1c)) when i'm running (cronjob) my script for backing up my .db configuration isn't working and reporting to me this:
"cp: (412fb1c).db is not a directory"

I can understand what it means, but I still can not solve it!

My script:
Code:
cp /data/freenas-v1.db /mnt/WDVolume_A/Data/Config_Backups/backups/`date +%Y%m%d`_`cat /etc/version | cut -d'-' -f2`_`cat /etc/version | cut -d'-' -f4`.db


Someone can help me?
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
Use a real script with variables instead of trying to do it with an one-liner (long, messy and hard to debug), especially when you start to have some date command ;)
 

Jacopx

Patron
Joined
Feb 19, 2016
Messages
367

lord_c

Cadet
Joined
Jan 22, 2015
Messages
2
Hi, i have just update to the latest version (FreeNAS-9.10-STABLE-201603252134 (412fb1c)) when i'm running (cronjob) my script for backing up my .db configuration isn't working and reporting to me this:
"cp: (412fb1c).db is not a directory"

I can understand what it means, but I still can not solve it!

My script:
Code:
cp /data/freenas-v1.db /mnt/WDVolume_A/Data/Config_Backups/backups/`date +%Y%m%d`_`cat /etc/version | cut -d'-' -f2`_`cat /etc/version | cut -d'-' -f4`.db


Someone can help me?

The problem is that the file /etc/version now has an extra space, between the date and the code in parentheses, as in 'FreeNAS-9.10-STABLE-201605240427 (64fcd8e)'.

I guess it will solve your problem:
Code:
cp /data/freenas-v1.db /mnt/nas/scripts/config_backup/`date +%Y%m%d`_`cat /etc/version | cut -d'-' -f2`_`cat /etc/version | cut -d'-' -f4 | tr ' ' '_'`.db
 
Status
Not open for further replies.
Top