Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions sbin/spark-daemon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ spark_rotate_log ()
if [ -n "$2" ]; then
num=$2
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@srowen
There provide a param,num, to set the number of logfile,but it wasn't used in line 179.Since it doesn't work,can I remove the param "num" and use it just as a variable?

fi

expr $num + 0 &>/dev/null
if [ $? -ne 0 ] || [ $num -eq 0 ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you trying to verify if num is a number? I get it but you would already get a bash error in $num -eq 0 if so and we don't otherwise validate script input that way. Isn't this forcing num to be nonzero, when I thought the issue was handling the case of 0 correctly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@srowen
Yes, we should avoid this scenario that num isn't number.If num isn't a number,num will be set to 5.

num=5
fi

if [ -f "$log" ]; then # rotate logs
while [ $num -gt 1 ]; do
prev=`expr $num - 1`
Expand Down