mirror of
https://github.com/daeuniverse/dae.git
synced 2025-07-05 16:00:24 +07:00
docs: update persistent script (#603)
This commit is contained in:
@ -21,23 +21,34 @@ We assume that your dae configuration file is stored in `/usr/local/etc/dae/` .
|
|||||||
cd /usr/local/etc/dae || exit 1
|
cd /usr/local/etc/dae || exit 1
|
||||||
version="$(dae --version | head -n 1 | sed 's/dae version //')"
|
version="$(dae --version | head -n 1 | sed 's/dae version //')"
|
||||||
UA="dae/${version} (like v2rayA/1.0 WebRequestHelper) (like v2rayN/1.0 WebRequestHelper)"
|
UA="dae/${version} (like v2rayA/1.0 WebRequestHelper) (like v2rayN/1.0 WebRequestHelper)"
|
||||||
|
fail=false
|
||||||
|
|
||||||
while IFS=':' read -r name url
|
while IFS=':' read -r name url
|
||||||
do
|
do
|
||||||
curl -fL -A "$UA" "$url" -o "${name}.sub.new"
|
curl --retry 3 --retry-delay 5 -fL -A "$UA" "$url" -o "${name}.sub.new"
|
||||||
if [[ $? -eq 0 ]]; then
|
if [[ $? -eq 0 ]]; then
|
||||||
mv "${name}.sub.new" "${name}.sub"
|
mv "${name}.sub.new" "${name}.sub"
|
||||||
chmod 0600 "${name}.sub"
|
chmod 0600 "${name}.sub"
|
||||||
echo "Downloaded $name"
|
echo "Downloaded $name"
|
||||||
else
|
else
|
||||||
rm "${name}.sub.new"
|
if [ -f "${name}.sub.new" ]; then
|
||||||
echo "Failed to download $name"
|
rm "${name}.sub.new"
|
||||||
fi
|
fi
|
||||||
|
fail=true
|
||||||
|
echo "Failed to download $name"
|
||||||
|
fi
|
||||||
done < sublist
|
done < sublist
|
||||||
|
|
||||||
dae reload
|
dae reload
|
||||||
|
|
||||||
|
if $fail; then
|
||||||
|
echo "Failed to update some subs"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
```
|
```
|
||||||
|
|
||||||
You need to give it proper permission:
|
You need to give it proper permission:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
chmod +x /usr/local/bin/update-dae-subs.sh
|
chmod +x /usr/local/bin/update-dae-subs.sh
|
||||||
```
|
```
|
||||||
@ -71,6 +82,7 @@ After=network-online.target
|
|||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStart=/usr/local/bin/update-dae-subs.sh
|
ExecStart=/usr/local/bin/update-dae-subs.sh
|
||||||
|
Restart=on-failure
|
||||||
```
|
```
|
||||||
|
|
||||||
## Configurations
|
## Configurations
|
||||||
|
Reference in New Issue
Block a user