Post

QNAP相关

自动启动

1
2
3
4
5
6
1. mount -t ext2 /dev/mmcblk0p5 /tmp/config
2. vim /tmp/config/autorun.sh
#!/bin/sh
screen -d -m /share/CACHEDEV1_DATA/frp/frpc -c /share/CACHEDEV1_DATA/frp/frpc.ini
3. chmod +x /tmp/config/autorun.sh
4. umount /tmp/config

注:mount的分区每个版本各不相同,具体参考下面第一个链接

参考内容

Running Your Own Application at Startup - QNAPedia

威联通NAS开机启动自定义脚本 - 浪人C (avday.cn)

setting crontab

1
2
3
vim /etc/config/crontab
crontab /etc/config/crontab
/etc/init.d/crond.sh restart

Crontab reboot

@reboot sleep 30 && /home/start.sh

not works

setting entware.sh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
l /etc/init.d/Entware.sh
/etc/init.d/Entware.sh -> /share/CACHEDEV1_DATA/.qpkg/Entware/Entware.sh


# 首先,我们需要把oh-my-zsh的配置放在硬盘中,否则重启就会被删除
# 这里假设硬盘路径为/share/CACHEDEV1_DATA/
mkdir -p /share/CACHEDEV1_DATA/.zsh
cd ~
mv .zsh_history .zshrc .oh-my-zsh /share/CACHEDEV1_DATA/.zsh

## 最重要的一步!
vi /share/CACHEDEV1_DATA/.qpkg/Entware/Entware.sh

## 找到start位置,在创建link的时候加入以下代码

/bin/ln -sf /share/CACHEDEV1_DATA/.zsh/.zshrc /root/.zshrc
/bin/ln -sf /share/CACHEDEV1_DATA/.zsh/.oh-my-zsh /root/.oh-my-zsh
/bin/ln -sf /share/CACHEDEV1_DATA/.zsh/.zsh_history /root/.zsh_history

##自定义添加启动

# startup Entware services
	/opt/etc/init.d/rc.unslung start
	/share/CACHEDEV1_DATA/.qpkg/Entware/bin/zerotier-one -d
	/opt/bin/nohup /share/CACHEDEV1_DATA/.qpkg/Entware/sbin/v2 -c /share/CACHEDEV1_DATA/.qpkg/Entware/etc/v2/config.json > /share/CACHEDEV1_DATA/.qpkg/Entware/etc/v2/nohup.log 2>&1 &
This post is licensed under CC BY 4.0 by the author.