NAS542 Backup from network

NewSouth
NewSouth Posts: 3  Freshman Member
Hello
I have two NAS542 - called NASCI and NASBU. I need to backup data from NASCI to NASBU, and its easy with tool "archive scheduler'. But the problem is NASCI cant see NASBU in destination of data transmitting because of firewall rules that i can't change. Otherwise NASBU CAN see NASCI to backup data. So i need to set up NASBU to backup data from network source to it's own storage, is it possible?

I found solution using rsync, but i cant schedule it
Thanks

Accepted Solution

  • Mijzelf
    Mijzelf Posts: 2,598  Guru Member
    First Anniversary 10 Comments Friend Collector First Answer
    Answer ✓
    Install in Entware the cron package, enable it

    chmod a+x /opt/etc/init.d/S10cron

    Edit the file /opt/etc/crontab, to meet your needs. (Google for crontab file syntax) I'd remove all current /opt/etc/cron.* entries. They don't do anything, but might spin up the disk.
    Then (re)start cron

    /opt/etc/init.d/S10cron restart

All Replies

  • Mijzelf
    Mijzelf Posts: 2,598  Guru Member
    First Anniversary 10 Comments Friend Collector First Answer
    How does that rsync solution work?
  • NewSouth
    NewSouth Posts: 3  Freshman Member
    edited December 2020
    I installed Entware on bots NAS,
    Then i run following commands:


    #start entware tools
    mkdir -p /i-data/298a8096/opt > /dev/null 2>&1
    mkdir -p /opt
    mount -o bind /i-data/298a8096/opt /opt
    /opt/etc/init.d/rc.unslung start
    PATH=$PATH:/opt/bin:/opt/sbin
    
    #copying SSH keys to ~/.ssh, nessesery after reboot:
    mkdir ~/.ssh/
    cp /i-data/298a8096/opt/id_rsa ~/.ssh/
    cp /i-data/298a8096/opt/id_rsa.pub ~/.ssh/
    cp /i-data/298a8096/opt/known_hosts ~/.ssh/ 
    
    #run rsync
    /i-data/298a8096/opt/bin/rsync -arht --rsync-path=/i-data/86e8767a/opt/bin/rsync --info=progress2 --log-file=/i-data/298a8096/nascibackup/nascibackup.log *****:/i-data/86e8767a/Project/Nascibackup /i-data/298a8096/nascibackup/
     | chmod 775 -R /i-data/298a8096/nascibackup/ | chown -R admin /i-data/298a8096/nascibackup/
    /i-data/298a8096/ is my hdd volume.
    What should i do to schredule it, like to run it once a week?
    How to keep this schedule after reboot?

  • Mijzelf
    Mijzelf Posts: 2,598  Guru Member
    First Anniversary 10 Comments Friend Collector First Answer
    Answer ✓
    Install in Entware the cron package, enable it

    chmod a+x /opt/etc/init.d/S10cron

    Edit the file /opt/etc/crontab, to meet your needs. (Google for crontab file syntax) I'd remove all current /opt/etc/cron.* entries. They don't do anything, but might spin up the disk.
    Then (re)start cron

    /opt/etc/init.d/S10cron restart

  • NewSouth
    NewSouth Posts: 3  Freshman Member
    edited December 2020
    Thank you Mijzelf for answer!
    I installed cron and it work properly (i tested with 1 min script) until NAS reboot.
    After reboot it doesnt work, and i need to start Entware (?) by this commands:

    mkdir -p /i-data/298a8096/opt > /dev/null 2>&1
    mkdir -p /opt
    mount -o bind /i-data/298a8096/opt /opt
    /opt/etc/init.d/rc.unslung start

    I installed Entware wrong i guess. I used this instruction: https://github.com/Entware/Entware/wiki/Install-on-Zyxel-NAS542

    There is problem to execute "entware" scrypt in .system/zy-pkgs:

    ~ # /i-data/.system/zy-pkgs/USRPKG_DEPS_START
    /i-data/.system/zy-pkgs/USRPKG_DEPS_START: line 1: entware: not found
    ~ # ls /i-data/.system/zy-pkgs/entware
    /i-data/.system/zy-pkgs/entware
    ~ # /i-data/.system/zy-pkgs/entware
    sh: /i-data/.system/zy-pkgs/entware: not found
    ~ #
    
    So the script is there, but it cant be executed even over SSH. Where might be the problem?

    Edit:
    i trying to test how the USRPKG_DEPS_START works when NAS booting, and seems it doesnt: i added this line to USRPKG_DEPS_START:

    echo "TESTAUTOBOOT" >> /i-data/298a8096/nascibackup/test1min.log

    but there is nothing is my test1min.log after NAS booting. If i execute script USRPKG_DEPS_START by myself, "TESTAUTOBOOT" appears in test1min.log

    So this USRPKG_DEPS_START doesnt execute on boot?
  • Mijzelf
    Mijzelf Posts: 2,598  Guru Member
    First Anniversary 10 Comments Friend Collector First Answer
    edited December 2020
    Hm. It should work. The USRPKG_DEPS_START is handled by /etc/init.d/zypkg_controller.sh, and this is the code:

    <div># - start to startup packages according to ${USRPKG_DEPS_START}</div><div>while read zypkg; do</div><div>&nbsp;&nbsp;&nbsp; bname=`basename ${zypkg}`</div><div>&nbsp;&nbsp;&nbsp; zypkg=${ZYPKG_PKG_SRC_PATH}/${bname}</div><div>&nbsp;&nbsp;&nbsp; Processed_Packages=${Processed_Packages}:${bname}</div><div>&nbsp;&nbsp;&nbsp; write_log "- starting package \"${bname}\" ..."</div><div>&nbsp;&nbsp;&nbsp; #ckeck ZYPKG_DEPS format</div><div>&nbsp;&nbsp;&nbsp; CHKVERSION=`grep "/i-data/" ${zypkg}`</div><div>&nbsp;&nbsp;&nbsp; if [ "$?" != "0" ]; then</div><div>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; PKGVOLPATH=`grep ${bname} ${PKGSTATUSFILE} |grep "Installed-Rule" |awk -F":" '{print $2}' |sed 's/\/$//g' |sed 's/ //g'`</div><div>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; zypkg=${PKGVOLPATH}/etc/init.d/${bname}</div><div>&nbsp;&nbsp;&nbsp; fi</div><div>&nbsp;&nbsp;&nbsp; if [ ! -x ${zypkg} ]; then</div><div>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; write_log "---> Error: start-up program \"${zypkg}\" is not existed or not excutable"</div><div>&nbsp;&nbsp;&nbsp; else</div><div>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ${zypkg} startup</div><div>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if [ "$?" == "0" ]; then</div><div>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; write_log "---> start \"${bname}\" successfully."</div><div>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else</div><div>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; write_log "---> start \"${bname}\" failed."</div><div>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fi</div><div>&nbsp;&nbsp;&nbsp; fi</div><div>done < ${USRPKG_DEPS_START}</div><div><br></div>
    So the script (entware in this case) has to be in the ZYPKG_PKG_SRC_PATH directory (/i-data/.system/zy-pkgs), it has to contain the string '/i-data/' and has to be executable.

    If /i-data/.system/zy-pkgs/entware doesn't execute, than it can't work. So you first have to solve that. I suggest to 'debug' it, by executing

    sh -x /i-data/.system/zy-pkgs/entware

    /Edit: I hate this forum software. It has borked up my scriptlet. In the editor it looks fine.
  • just leave this here

Consumer Product Help Center