Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
9781958a
Commit
9781958a
authored
Aug 07, 2020
by
houkime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new cleanup script
parent
961a493a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
4 deletions
+41
-4
src/exp/com/src/pwr_cleanup.sh
src/exp/com/src/pwr_cleanup.sh
+41
-4
No files found.
src/exp/com/src/pwr_cleanup.sh
View file @
9781958a
...
@@ -40,15 +40,52 @@
...
@@ -40,15 +40,52 @@
# NOTE! This file removes all IPC objects for the user.
# NOTE! This file removes all IPC objects for the user.
# If you have other program which creates IPC objects,
# If you have other program which creates IPC objects,
# then do not use this script
# then do not use this script
#
uid
=
`
id
-u
`
function
extract_cols
(){
filename
=
$1
#/proc/sysvipc/shm
colname1
=
$2
#"uid"
colname2
=
$3
#"shmid"
header
=
true
N
=
0
result
=
""
while
read
-r
line
;
do
if
$header
then
arr
=(
$line
)
for
i
in
"
${
!arr[@]
}
"
;
do
if
[[
"
${
arr
[
$i
]
}
"
=
"
${
colname1
}
"
]]
;
then
N1
=
$i
;
fi
if
[[
"
${
arr
[
$i
]
}
"
=
"
${
colname2
}
"
]]
;
then
N2
=
$i
;
fi
done
header
=
false
else
arr
=(
$line
)
# echo "${arr[$N]}";
result
=
"
$result
${
arr
[
$N1
]
}
${
arr
[
$N2
]
}
\n
"
fi
done
<
$filename
printf
"
$result
"
}
# remove semaphores
# remove semaphores
eval
`
ipcs
-s
|grep ^0x|grep
"[
\t
]
$USER
[
\t
]
"
|awk
'{printf "ipcrm sem %s;", $2}'
`
eval
`
extract_cols /proc/sysvipc/sem uid semid |grep
"
$uid
"
|awk
'{printf "ipcrm sem %s;", $2}'
`
# remove message queues
# remove message queues
eval
`
ipcs
-q
|grep ^0x|grep
"[
\t
]
$USER
[
\t
]
"
|awk
'{printf "ipcrm msg %s;", $2}'
`
eval
`
extract_cols /proc/sysvipc/msg uid msqid |grep
"
$uid
"
|awk
'{printf "ipcrm msg %s;", $2}'
`
# remove shared memory
# remove shared memory
eval
`
ipcs
-m
|grep ^0x|grep
"[
\t
]
$USER
[
\t
]
"
|awk
'{printf "ipcrm shm %s;", $2}'
`
eval
`
extract_cols /proc/sysvipc/shm uid shmid |grep
"
$uid
"
|awk
'{printf "ipcrm shm %s;", $2}'
`
tmpdir
=
'/tmp/'
tmpdir
=
'/tmp/'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment