Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3f4d68c

Browse files
committed
Fix on Linux
1 parenta25a785 commit3f4d68c

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

‎src/bin/ipcclean/ipcclean.sh

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22
#
3-
# $Header: /cvsroot/pgsql/src/bin/ipcclean/Attic/ipcclean.sh,v 1.9 2001/02/1006:12:15 momjian Exp $
3+
# $Header: /cvsroot/pgsql/src/bin/ipcclean/Attic/ipcclean.sh,v 1.10 2001/02/1010:27:28 petere Exp $
44
#
55

66
CMDNAME=`basename$0`
@@ -38,8 +38,6 @@ EffectiveUser=`id -n -u 2>/dev/null || whoami 2>/dev/null`
3838
# This is based on RedHat 5.2.
3939
#
4040
if [`uname`='Linux' ];then
41-
ipcs_id=
42-
ipcs_lpid=
4341
did_anything=
4442

4543
if ps x| grep -s'[p]ostmaster'>/dev/null2>&1;then
@@ -48,34 +46,36 @@ if [ `uname` = 'Linux' ]; then
4846
fi
4947

5048
# shared memory
51-
forvalin`ipcs -m -p| grep'^[0-9]'| awk'{printf "%s%s\n", $1, $3, $4}'`
49+
forvalin`ipcs -m -p| grep'^[0-9]'| awk'{printf "%s:%s:%s\n", $1, $3, $4}'`
5250
do
53-
if [-z"$ipcs_id" ];then
54-
ipcs_id=$val
55-
# Note: We can do -n here, because we know the platform.
56-
echo -n"Shared memory$ipcs_id ..."
57-
continue
58-
fi
51+
save_IFS=$IFS
52+
IFS=:
53+
set X$val
54+
shift
55+
IFS=$save_IFS
56+
ipcs_shmid=$1
57+
ipcs_cpid=$2
58+
ipcs_lpid=$3
5959

60-
ipcs_lpid=$val
60+
# Note: We can do -n here, because we know the platform.
61+
echo -n"Shared memory$ipcs_shmid ..."
6162

6263
# Don't do anything if process still running.
6364
# (This check is conceptually phony, but it's
6465
# useful anyway in practice.)
65-
ps hj$ipcs_lpid>/dev/null2>&1
66+
ps hj$ipcs_cpid$ipcs_lpid>/dev/null2>&1
67+
if [$?-eq 0 ];then
68+
echo"skipped; process still exists (pid$ipcs_cpid or$ipcs_lpid)."
69+
continue
70+
fi
71+
72+
# try remove
73+
ipcrm shm$ipcs_shmid
6674
if [$?-eq 0 ];then
67-
echo"skipped. Process still exists (pid$ipcs_lpid)."
75+
did_anything=t
6876
else
69-
# try remove
70-
ipcrm shm$ipcs_id
71-
if [$?-eq 0 ];then
72-
did_anything=t
73-
else
74-
exit
75-
fi
77+
exit
7678
fi
77-
ipcs_id=
78-
ipcs_lpid=
7979
done
8080

8181
# semaphores

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp