2009年1月19日月曜日

Thuderbird拡張

ReminderFox:リマインダー



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デーモンがアイドリングが完了し、サービスできる用になる。



2009年1月6日火曜日

vi

置換
:%s/置換前文字列/置換後文字列/gc
※最後のcは確認。



2008年12月17日水曜日

文字コード変換

◎lv
SJIS→UTF変換可能。


△NextFTP Ver4.85
ファイル転送と同時にSJIS→UTF変換できる。
試用期限があり。

×iconv
SJIS→UTF変換できるが、バックスラッシュ変換問題がある。
yenマークのバックスラッシュを英語のバックスラッシュ(\)ではなく
まじめにyen記号に変換する。
コンパイラがyesマークバックスラッシュを解釈できない。


【lvで文字コード変換】
$ cat s2u.com
#!/bin/sh

mkdir -p ./UTF
rm -f ./UTF/*

for file in `find . -type f`;
do
echo $file

/usr/com/bin/lv -Is -Ou8 $file > ./UTF/tmpfile
#iconv -f shift_JIS -t UTF-8 $file > ./UTF/tmpfile
#iconv -f eucJP -t UTF-8 $file > tmpfile
#iconv -f Shift_JIS -t UTF-8 sjis.txt > utf-8.txt

mv ./UTF/tmpfile ./UTF/$file

done

exit


役に立たないかもしれないがイチオウiconv
$ cat iconv.com
#!/bin/sh
for file in `find . -type f`;
do
echo $file
iconv -f eucJP -t UTF-8 $file > tmpfile
mv tmpfile $file
done
exit



2008年11月28日金曜日

Poderosaでカラー表示

主にlinux(RedHat)上で使う

Ver4.3.3b
setenv TERM=kterm
xterm-colorだとemacs検索で背景色が紫になる。

Ver4.1.0
export TERM=xterm-color

Poderosa
ツール オプション 表示 背景色:黒 テキスト色:白

vimでも、emacsでも。



2008年11月20日木曜日

ftpスクリプト

-n:自動ログイン抑制


ftp -n HOSTNAME << EOF
user USERNAME PASSWORD
cd /home/user
bin
get prog.exe
bye
EOF