Skip to content

Commit

Permalink
remote process picking without ps or ps with limited options
Browse files Browse the repository at this point in the history
  • Loading branch information
ssaraswati committed May 13, 2022
1 parent e50f4f2 commit 981023f
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion scripts/remoteProcessPickerScript
Original file line number Diff line number Diff line change
@@ -1 +1,24 @@
uname && if [ "$(uname)" = "Linux" ] ; then ps -axww -o pid=,flags=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args= ; exit; elif [ "$(uname)" = "Darwin" ] ; then ps -axww -o pid=,flags=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args= -c; fi
#!/bin/sh
uname && if [ "$(uname)" = "Linux" ]; then
ps -axww -o pid=,flags=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args= >/dev/null 2>/dev/null
ret=$?
if [ $ret -eq 0 ]; then
ps -axww -o pid=,flags=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args=
else

# Try to mimic the output of ps -axww -o pid=,flags=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args= from /proc/$pid/ data
echo " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
for pid in `cd /proc && ls -d [0-9]*`
do {
if [ -e /proc/$pid/stat ]
then
flags=`awk '{print $9}' /proc/$pid/stat`;
command=`awk '{print $2}' /proc/$pid/stat | tr -d '()'`
args=`xargs -0 < /proc/$pid/cmdline | awk '{print $2}'`;
printf "%5s %.1s %-49s %-27s \n\r" $pid $flags $command $args
fi
};
done
fi

elif [ "$(uname)" = "Darwin" ]; then ps -axww -o pid=,flags=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args= -c; fi

0 comments on commit 981023f

Please sign in to comment.