The OS is AIX.
I created a program to kill long running pid processes.
I am getting the following error message:
-f command cannot be found.
I also want to count the number of pids that are killed and append the results to a text file. I am new to shell script programming.
1.The first part of code is exporting a text file column containing ppids.
pid.txt contents are as follows:
2. The second part of the code changes permission on the PpidFile
3. The third part of the code loops through the column in the text
file and kill each Ppid.
4. finally a line of text is appended to a text file. The text contains the total number of pids killed and the date.
Here is my code:
if [[ -f "$PpidFile" ]]
/bin/chmod 755 $PpidFile
if [ 0 -eq $Ret ]
for RelatedEachPid in `/bin/grep -v "Ppid" $PpidFile | /usr/bin/tr "\n" " "`
/bin/echo "kill -9 $RelatedEachPid"
/bin/kill -9 $RelatedEachPid
if [ 0 -ne $Ret ]
/bin/echo "kill -9 $RelatedEachPid Fail"
/bin/echo "kill -9 $RelatedEachPid
echo "total of pids killed: wc-l $PIDkill - $date" >> pidkill.txt