1
rated 0 times
[
1]
[
0]
/ answers: 1 / hits: 771
/ 1 Year ago, fri, may 5, 2023, 7:21:16
On my Ubuntu linux computer I'm making a loop like this using my shell bash
HERE MY CODE "./upperscript"
cat filename.txt | while read LINE || [[ -n $LINE ]];
do
./script $LINE >> $LINE.txt 2>> $LINE.err & sleep 1
wait;
done > /dev/null 2>&1 &
echo "[PID $!]"
Here I go
Now, when the script disappears there are a lot of forked process (one at a time) over -bash name like this
username 15029 0.0 0.3 7404 3060 ? S mag31 0:00 -bash
username 13849 0.8 0.6 33048 6432 ? S mag31 0:08 _ ./script HERE MY LINE
username 13869 0.1 0.3 33048 6451 ? S mag31 0:09 _ ./otherscript HERE MY LINE
username 13881 0.1 0.1 33048 6465 ? S mag31 0:08 _ ./otherscript HERE MY LINE
how to rename the process with pid 15029 that now it's called simply "-bash"?
I tryed also
$ chmod 777 /proc/15029/comm
chmod: changing permissions of '/proc/15029/comm': Operation not permitted
to do then
echo 'PROCESSNAME' > /proc/15029/comm"
but like u see the error is
"Operation not permitted" also using sudoers username or root (su)
if there's not a way, could I rename it from the process itself?
Saying using
bash -c "exec -a <MyProcessName> <Command>"
in a multiline command like my while?
Thanks a lot
More From » bash