[ 
https://issues.apache.org/jira/browse/SOLR-8031?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15647543#comment-15647543
 ] 

Uwe Reh commented on SOLR-8031:
-------------------------------

Sorry,
at the moment I'm not able to create a own development environment. I can just 
help with some facts.
ps:
- Up to and including Solaris 10 is the command to show all processes is 
'/usr/bin/ps -ef'. As alternative you may use '/usr/ucb/ps aux' 
- Since Solaris 11 express '/usr/ucb' is deprecated, but '/usr/bin/ps' accepts 
the parameters 'aux' as well as '-ef'
sleep:
- Up to and including Solaris 10 accepts sleep only integers. Floats are 
rejected with "Wrong character in parameter"
- Solaris 11: (I dont know)
- OmniOs (a 11-like OpenSolaris clone) accepts floats as parameter

Maybe the following workaround is better than my initial suggestion is to test 
the exit value
- if "/usr/bin/ps aux" fails use "/usr/bin/ps -ef"
- if "/usr/bin/sleep 0.5" fails use "/usr/bin/sleep 1"


{code}
function spinner() {
  local psargs="a"
  if ps $psargs >/dev/null 2>&1
  then
      # use bsd/linux style 
      psargs="aux"
  else
      # use solaris alternative
      psargs="-ef"
  fi

  local delay=0.1
  if sleep $delay 2>/dev/null
  then
    # new sleep can float 
    delay=0.5
  else
    # fallback to integer
    delay=1
  fi

  local pid=$1
  local spinstr='|/-\'
  while [ "$(ps $psargs | awk '{print $2}' | grep -w $pid)" ]; do
      local temp=${spinstr#?}
      printf " [%c]  " "$spinstr"
      local spinstr=$temp${spinstr%"$temp"}
      sleep $delay
      printf "\b\b\b\b\b\b"
  done
  printf "    \b\b\b\b"
}
{code}




> /bin/solr on Solaris and clones (two sub issues)
> ------------------------------------------------
>
>                 Key: SOLR-8031
>                 URL: https://issues.apache.org/jira/browse/SOLR-8031
>             Project: Solr
>          Issue Type: Improvement
>          Components: scripts and tools
>    Affects Versions: 5.2.1, 5.3
>         Environment: Solaris 5.10, OmniOs
>            Reporter: Uwe Reh
>            Priority: Minor
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> 1.) The default implementation fo 'ps' in Solaris can't handle "ps auxww".
> Fortunatly you can call "/use/ucb/ps auxww" instead. Maybe one can add 
> something like ...
> > PS=ps
> > if [ "$THIS_OS" == "SunOS" ]; then
> >   PS=/usr/ucb/ps
> > fi
> and replace all "ps aux" with "$PS aux" 
> 2.) Some implementations of 'sleep' support integers only. The function 
> 'spinner()' is using 0.5 as parameter. A delay of one second does not look 
> that nice, but would be more portable.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to