ReminderFox:リマインダー
2009年1月19日月曜日
2009年1月14日水曜日
プロセス確認 ps kill pstree
プロセス情報を確認
プロセスツリーを表示
pstree -cap
-c:Expansion
-a:With Argument
-p:pid
CPU使用率、スレッドも表示
ps auxww -L | egrep myProg | egrep -v "tail|grep|emacs"
プロセスグループを表示(j)
ps -efj
プロセスグループをkill
kill -s TERM -1442(ppid or pgid)
参考スクリプトとプログラム参照。
【bash】
#!/bin/bash
debugMsg=0;
ALIVE=`/bin/ps -el | /bin/grep $1 | /bin/grep -v grep`
if [ $debugMsg -eq 1 ]
then
echo "\"$ALIVE\""
fi
if [ -n "$ALIVE" ];
then
echo "Alive"
else
echo "NOT alive"
fi
exit 0
ALIVE=`/bin/ps -el | /bin/grep dhcpd | /bin/grep -v grep`
if [ -n "\$ALIVE" ];★× 正:if [ -n "$ALIVE" ];
then
echo "Alive"
else
echo "NOT alive lmgrd"
cd foge
echo "Start dhcpd"
cd $HOME
fi
(参考スクリプトとプログラム)
ps -efj | head -1
ps -ef|grep create5Process|grep -v grep
./chkpid >> /dev/null &
./chkpid >> /dev/null &
./chkpid >> /dev/null &
./chkpid >> /dev/null &
./chkpid >> /dev/null &
./chkpid >> /dev/null &
echo ""
ps -efj | head -1
ps -ef|grep chkpid|grep -v grep
echo ""
echo "kill -s TERM -pid"
exit 0
/* --- chkpid.c --- */
#include <stdio.h>
#include <stdint.h>
int main()
{
printf("uint32_t(-1)=%x\n", uint32_t(-1));
printf("Infinity loop\n");
while(1)
;
return 0;
}
/* --- killpg.c --- */
#include <stdio.h>
#include <signal.h>
#include <errno.h>
#include <stdlib.h>
int main()
{
int pgrp;
int sig = SIGKILL;
int status;
printf("PPID = ");scanf("%d", &pgrp);
status = killpg(pgrp, sig);
if(status) {
printf("Error status=%d errno=%d\n", status, errno);
exit(1);
}
return 0;
}
ntpサーバーの設定
/etc/ntp.conf
↓最終行に追加
restrict 192.168.50.0 mask 255.255.255.0 nomodify notrap #comment
サービス起動
# /sbin/service ntpd start
3,4分するとntpデーモンがアイドリングが完了し、サービスできる用になる。