2010年9月12日 星期日

【QNAP】預設值微調

  • 更改檔案下載預設路徑
  • 更改 /etc/config/smb.conf 檔案裏的 Qdownload path from "/share/Qdownload" to "/share/mysharefolder/newdownloadpath",然後重新開機。

  • Mount network drive
  • > mkdir newfolder
    > mount.cifs //192.168.1.1/Data newfolder -o user=username,pass=password

  • 開機時自動執行指令
  • Running Your Own Application at Startup # vi /etc/config/qpkg.conf

    • Log into your QNAP device using SSH or Telnet, for instance by using Putty
    • Edit QPKG config file:
    # vi /etc/config/qpkg.conf
    
    • Declare a new dummy package by adding something like that in this file, but take care about the order. e.g. if you would like to start a service from a optware package, be sure optware is initialized before:
    [autorun]
    Name = autorun
    Version = 0.1
    Author = neomilium
    Date = 2013-05-06
    Shell = /share/MD0_DATA/.qpkg/autorun/autorun.sh
    Install_Path = /share/MD0_DATA/.qpkg/autorun
    Enable = TRUE
    
    As you can see, Shell is the interesting variable: at boot-time, QNAP OS will launch each QPKG's Shell variable content.
    Note: if your NAS doesn't have /share/MD0_DATA (i.e. is a one-drive NAS), put the right directory into the Shell and Install_Path variables and adapt the following commands to your needs.
    • Create the dummy package directory:
    # mkdir /share/MD0_DATA/.qpkg/autorun
    
    • Create the autorun script with the contents of your choice:
    # vi /share/MD0_DATA/.qpkg/autorun/autorun.sh
    
    Note: don't forget "#!/bin/sh" at the beginning of script.
    • Set the execute bit:
    # chmod +x /share/MD0_DATA/.qpkg/autorun/autorun.sh
    
    • Reboot and enjoy!