diff options
author | srividya0208 <a.srividya@vyos.io> | 2021-06-16 13:42:22 -0400 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2021-06-20 09:23:05 +0200 |
commit | 2e9039f9e36284fcfa7ad3fbd32290fc3f78e91f (patch) | |
tree | b3a3e7d48770b4b38c5e6d168bac80398c13d9ef | |
parent | 3798d99cff9b2d539b51dbf1b495e2caa4dae18d (diff) | |
download | vyatta-op-2e9039f9e36284fcfa7ad3fbd32290fc3f78e91f.tar.gz vyatta-op-2e9039f9e36284fcfa7ad3fbd32290fc3f78e91f.zip |
op-mode: T3582: Fix the function of "delete log file" command
Added the compeletion help to show the list of the files and also changed
the command to delete the file as the existing command was deleting the file
and not recreating the file to write the new logs. So modified the command
so that it will delete the content of the file.
-rw-r--r-- | scripts/vyatta-delete-log-file.sh | 2 | ||||
-rw-r--r-- | templates/delete/log/file/node.tag/node.def | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/scripts/vyatta-delete-log-file.sh b/scripts/vyatta-delete-log-file.sh index 8562738..577106d 100644 --- a/scripts/vyatta-delete-log-file.sh +++ b/scripts/vyatta-delete-log-file.sh @@ -2,7 +2,7 @@ if [ -e /var/log/user/"$1" ] then - rm -f /var/log/user/"$1" + echo -n "" > /var/log/user/"$1" else echo "File does not exist" fi diff --git a/templates/delete/log/file/node.tag/node.def b/templates/delete/log/file/node.tag/node.def index 95e46b6..ce4a4f7 100644 --- a/templates/delete/log/file/node.tag/node.def +++ b/templates/delete/log/file/node.tag/node.def @@ -1,2 +1,5 @@ help: Delete the specified log file +allowed: local -a array ; + array=( /var/log/user/* ) ; + echo -n ${array[@]##*/} run: sudo ${vyatta_bindir}/sudo-users/vyatta-delete-log-file.sh "$4" |