Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
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

 Answers
2

I have the same issue. We can't do this


echo 'PROCESSNAME' > /proc/15029/comm"

It's a question of priviledges


[#1511] Sunday, May 7, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ionash

Total Points: 214
Total Questions: 111
Total Answers: 116

Location: Sudan
Member since Thu, May 7, 2020
4 Years ago
;