Applicable Products:
Some advanced uses of your NAS may require you to run custom applications at boot-time. Even though QNAP NAS are Linux-based, you cannot use the usual Linux methods for launching an application at startup: default config files are reset on every startup.
Skills required
- must be able to remote login via SSH (e.g. use SSH PuTTY)
- must know how to edit files using nano, vi, or edit via SFTP (e.g. use WinSCP)
MTD-based method
Autorun.sh is a script which will be executed on every startup of the TS-x09, TS-x19 and TS-x39. Editing this file allows you to start your own programs or overwrite config files with your own copies.
Manual edit of autorun.sh
Log into your QNAP device using SSH, for instance by using Putty
Optional: install nano; use ipkg install nano & edit with nano instead of vi
Mount config ramblock by finding your specific model below:
All HAL-based Intel and AMD NAS:
Note: Starting from QTS 4.3.3 it's required to enable the autorun.sh processing in the Control Panel -> Hardware -> General: Run user defined startup processes (autorun.sh)
TS-212P3, TS-230:Mount the config ramblock /dev/mmcblk0p5:
mount -t ext2 /dev/mmcblk0p5 /tmp/config
TS-269L:Mount the config ramblock /dev/sdc6:
mount -t ext2 /dev/sdc6 /tmp/config
TS-439, TS-509, TS-639, TS-809, TS-809U (x86):Mount the config ramblock /dev/sdx6:
mount -t ext2 /dev/sdx6 /tmp/config
TS-109, TS-109P, TS-110, TS-119,TS-209, TS-209P, TS-212, TS-219, TS-409 (Marvell ARM), TS-412, TS-419P:Mount the config ramblock /dev/mtdblock5:
Note: On TS-219P II, you may have to use ext4 instead of ext2
mount -t ext2 /dev/mtdblock5 /tmp/config
TS-201:Mount the config ramblock /dev/mtdblock4:
mount -t ext2 /dev/mtdblock4 /tmp/config
Create/Edit /tmp/config/autorun.sh.
Edit autorun.sh by vi using this command # vi /tmp/config/autorun.sh then enter edit mode by pressing a
- Edit whatever you need to
- Exit edit mode: press ESC
- Save and exit: x
Or editing autorun.sh using a desktop PC and e.g. SFTP
Ensure that /tmp/config/autorun.sh is executable using this command # chmod +x /tmp/config/autorun.sh
IMPORTANT: Unmount the mounted flash partition using this command # umount /tmp/config
editautorun.sh: script to ease autorun.sh edit
If you edit this file regularly you can save some time by creating a shell script (e.g. editautorun.sh) to automate the process. You can call the script by either putting it in the environment path, or add its folder to the path or call it by an alias.
The script contents are:
All HAL-based Intel and AMD NAS use ...
mount $(/sbin/hal_app --get_boot_pd port_id=0)6 /tmp/config
touch /tmp/config/autorun.sh
chmod +x /tmp/config/autorun.sh
$EDITOR /tmp/config/autorun.sh
umount /tmp/config
All AL-based NAS(TS-x31+ and TS-x31X) and TS-x31 use ...
ubiattach -m 6 -d 2
/bin/mount -t ubifs ubi2:config /tmp/config
vi /tmp/config/autorun.sh
chmod +x /tmp/config/autorun.sh
echo .
echo "unmounting /tmp/config..."
umount /tmp/config
ubidetach -m 6
TS-230 use ...
mount -t ext2 /dev/mmcblk0p5 /tmp/config
vi /tmp/config/autorun.sh
chmod +x /tmp/config/autorun.sh
echo .
echo "unmounting /tmp/config..."
umount /tmp/config
TAS-x68, TS-x28 use ...
/bin/mount -t ext4 /dev/mmcblk0p7 /tmp/config
vi /tmp/config/autorun.sh
chmod +x /tmp/config/autorun.sh
echo .
echo "unmounting /tmp/config..."
umount /tmp/config
TS-439, TS-509, TS-639, TS-809, TS-809U (x86) use ...
mount -t ext2 /dev/sdx6 /tmp/config
vi /tmp/config/autorun.sh
chmod +x /tmp/config/autorun.sh
echo .
echo "unmounting /tmp/config..."
For TS-109, TS-109P, TS-119, TS-209, TS-209P, TS-219, TS-412, TS-409 (Marvell ARM) use ...
mount -t ext2 /dev/mtdblock5 /tmp/config
vi /tmp/config/autorun.sh
chmod +x /tmp/config/autorun.sh
echo .
echo "unmounting /tmp/config..."
umount /tmp/config
For TS-201 use ...
mount -t ext2 /dev/mtdblock4 /tmp/config
vi /tmp/config/autorun.sh
chmod +x /tmp/config/autorun.sh
echo .
echo "unmounting /tmp/config..."
umount /tmp/config
Using "init" script to mount the flash
The QNAP GUI has the ability to view the autorun.sh content. As at V4.5.1.1540 on a TS-831XU-RP this is how the GUI does that:
/etc/init.d/init_disk.sh mount_flash_config
(displays /tmp/nasconfig_tmp/autorun.sh)
/etc/init.d/init_disk.sh umount_flash_config
Using these commands, you can create/edit the "autorun.sh" in the location given.
Allow running autorun.sh during startup
After completing the autorun.sh, please don't forget to enable the option to allow running autorun.sh during the system startup.

적용되는 제품:
NAS의 고급 사용 중 일부는 부팅 시 사용자 정의 애플리케이션을 실행해야 할 수 있습니다. QNAP NAS는 Linux 기반이지만, 시작 시 애플리케이션을 실행하기 위해 일반적인 Linux 방법을 사용할 수 없습니다. 기본 구성 파일은 매번 시작 시 재설정됩니다.
필요한 기술
- SSH를 통해 원격 로그인할 수 있어야 합니다 (예: SSH PuTTY사용)
- nano, vi를 사용하여 파일을 편집하거나 SFTP를 통해 편집할 수 있어야 합니다 (예: WinSCP사용)
MTD 기반 방법
Autorun.sh는 TS-x09, TS-x19 및 TS-x39의 매번 시작 시 실행되는 스크립트입니다. 이 파일을 편집하면 자신의 프로그램을 시작하거나 구성 파일을 자신의 복사본으로 덮어쓸 수 있습니다.
autorun.sh 수동 편집
SSH를 사용하여 QNAP 장치에 로그인합니다. 예를 들어 Putty를 사용합니다.
선택 사항: nano를 설치합니다; ipkg install nano를 사용하여 nano로 편집합니다. vi 대신 사용합니다.
아래에서 특정 모델을 찾아 구성 램블록을 마운트합니다:
모든 HAL 기반 Intel 및 AMD NAS:
참고: QTS 4.3.3부터는제어판 -> 하드웨어 -> 일반: 사용자 정의 시작 프로세스 실행(autorun.sh)에서 autorun.sh 처리를 활성화해야 합니다.
TS-212P3, TS-230: 구성 램블록 /dev/mmcblk0p5를 마운트합니다:
mount -t ext2 /dev/mmcblk0p5 /tmp/config
TS-269L: 구성 램블록 /dev/sdc6를 마운트합니다:
mount -t ext2 /dev/sdc6 /tmp/config
TS-439, TS-509, TS-639, TS-809, TS-809U (x86): 구성 램블록 /dev/sdx6 마운트:
mount -t ext2 /dev/sdx6 /tmp/config
TS-109, TS-109P, TS-110, TS-119, TS-209, TS-209P, TS-212, TS-219, TS-409 (Marvell ARM), TS-412, TS-419P: 구성 램블록 /dev/mtdblock5 마운트:
참고: TS-219P II에서는 ext2 대신 ext4를 사용해야 할 수 있습니다
mount -t ext2 /dev/mtdblock5 /tmp/config
TS-201: 구성 램블록 /dev/mtdblock4 마운트:
mount -t ext2 /dev/mtdblock4 /tmp/config
/tmp/config/autorun.sh를 생성/편집합니다.
이 명령어를 사용하여 vi로 autorun.sh를 편집합니다 # vi /tmp/config/autorun.sh 그런 다음a를 눌러 편집 모드로 들어갑니다
- 필요한 내용을 편집합니다
- 편집 모드 종료: ESC 키 누르기
- 저장하고 종료: x
데스크탑 PC와 예를 들어 SFTP를 사용하여 autorun.sh를 편집합니다
이 명령어를 사용하여 /tmp/config/autorun.sh가 실행 가능하도록 합니다 # chmod +x /tmp/config/autorun.sh
중요:이 명령어를 사용하여 마운트된 플래시 파티션을 해제합니다 # umount /tmp/config
editautorun.sh: autorun.sh 편집을 쉽게 하기 위한 스크립트
이 파일을 정기적으로 편집하는 경우, 셸 스크립트(예: editautorun.sh)를 만들어 프로세스를 자동화하여 시간을 절약할 수 있습니다. 스크립트를 환경 경로에 넣거나, 폴더를 경로에 추가하거나, 별칭으로 호출할 수 있습니다.
스크립트 내용은 다음과 같습니다:
모든 HAL 기반 Intel 및 AMD NAS는 ...
mount $(/sbin/hal_app --get_boot_pd port_id=0)6 /tmp/config
touch /tmp/config/autorun.sh
chmod +x /tmp/config/autorun.sh
$EDITOR /tmp/config/autorun.sh
umount /tmp/config
모든 AL 기반 NAS(TS-x31+ 및 TS-x31X) 및 TS-x31은 ... 사용
ubiattach -m 6 -d 2
/bin/mount -t ubifs ubi2:config /tmp/config
vi /tmp/config/autorun.sh
chmod +x /tmp/config/autorun.sh
echo .
echo "unmounting /tmp/config..."
umount /tmp/config
ubidetach -m 6
TS-230은 ... 사용
mount -t ext2 /dev/mmcblk0p5 /tmp/config
vi /tmp/config/autorun.sh
chmod +x /tmp/config/autorun.sh
echo .
echo "unmounting /tmp/config..."
umount /tmp/config
TAS-x68, TS-x28은 ... 사용
/bin/mount -t ext4 /dev/mmcblk0p7 /tmp/config
vi /tmp/config/autorun.sh
chmod +x /tmp/config/autorun.sh
echo .
echo "unmounting /tmp/config..."
umount /tmp/config
TS-439, TS-509, TS-639, TS-809, TS-809U (x86)은 ... 사용
mount -t ext2 /dev/sdx6 /tmp/config
vi /tmp/config/autorun.sh
chmod +x /tmp/config/autorun.sh
echo .
echo "unmounting /tmp/config..."
TS-109, TS-109P, TS-119, TS-209, TS-209P, TS-219, TS-412, TS-409 (Marvell ARM)은 ... 사용
mount -t ext2 /dev/mtdblock5 /tmp/config
vi /tmp/config/autorun.sh
chmod +x /tmp/config/autorun.sh
echo .
echo "unmounting /tmp/config..."
umount /tmp/config
TS-201의 경우 ...
mount -t ext2 /dev/mtdblock4 /tmp/config
vi /tmp/config/autorun.sh
chmod +x /tmp/config/autorun.sh
echo .
echo "unmounting /tmp/config..."
umount /tmp/config
"init" 스크립트를 사용하여 플래시를 마운트합니다
QNAP GUI는 autorun.sh 내용을 볼 수 있는 기능이 있습니다. TS-831XU-RP의 V4.5.1.1540에서 GUI가 이를 수행하는 방법은 다음과 같습니다:
/etc/init.d/init_disk.sh mount_flash_config
(/tmp/nasconfig_tmp/autorun.sh 표시)
/etc/init.d/init_disk.sh umount_flash_config
이 명령어를 사용하여 지정된 위치에서 "autorun.sh"를 생성/편집할 수 있습니다.
시작 시 autorun.sh 실행 허용
autorun.sh를 완료한 후 시스템 시작 시 autorun.sh 실행을 허용하는 옵션을 활성화하는 것을 잊지 마세요.
