Skip to content

Commit baa105b

Browse files
authored
Merge pull request #9 from jfut/fix-save-current-list
fix: exit code 141 when attempting to save the current list (#8)
2 parents 71d8155 + f0b46ba commit baa105b

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Fast update of IP set for ipset.
88
## Usage
99

1010
```bash
11-
ipset-fast-update 1.5.0
11+
ipset-fast-update 1.5.1
1212

1313
Usage:
1414
ipset-fast-update -n SET_NAME [-i PATH]... [-u URL]... [-e EXCLUDE_PATH]... [OPTIONS...]

ipset-fast-update

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
set -euo pipefail
1515

16-
VERSION="1.5.0"
16+
VERSION="1.5.1"
1717

1818
ALERT_THRESHOLD_RATIO="80"
1919
IS_TEMPORARY="0"
@@ -334,11 +334,13 @@ main() {
334334
fi
335335

336336
if [[ "${IPSET_SAVE_ON_STOP}" != "yes" ]]; then
337-
echo "--------------------------------------------------------------------------------------"
338-
echo "[WARNING]: IPSET_SAVE_ON_STOP in ${IPSET_CONFIG} is not set to yes."
339-
echo "It is recommended that you set it to 'yes' for the setting to take effect permanently."
340-
echo "If you do not want to save the configuration automatically, use the -t option."
341-
echo "--------------------------------------------------------------------------------------"
337+
cat << _EOF_
338+
--------------------------------------------------------------------------------------
339+
[WARNING]: IPSET_SAVE_ON_STOP in ${IPSET_CONFIG} is not set to yes.
340+
It is recommended that you set it to 'yes' for the setting to take effect permanently.
341+
If you do not want to save the configuration automatically, use the -t option.
342+
--------------------------------------------------------------------------------------
343+
_EOF_
342344
fi
343345
/usr/libexec/ipset/ipset.start-stop save
344346
fi
@@ -348,7 +350,7 @@ main() {
348350
[[ "${IS_VERBOSE}" -eq 1 ]] && echo "# Check set: ipset list -t ${SET_NAME}, ipset list ${SET_NAME}"
349351

350352
# Save current list file
351-
yes | mv "${LIST_FILE}" "${LIST_CURRENT_FILE}"
353+
cat "${LIST_FILE}" > "${LIST_CURRENT_FILE}"
352354
}
353355

354356
[[ ${#BASH_SOURCE[@]} = 1 ]] && main "$@"

0 commit comments

Comments
 (0)