Linux下用PYTHON查找同名进程
1.可执行程序
os.system('pgrep %s > %s' % (process, output))
pidfile = open("output", 'r')
totalpid = len(pidfile.readlines())
pidfile.close()
if totalpid == 0 :
#没有进程
return False
elif totalpid > 1 :
#多个进程
os.system('killall -9 %s' % (process))
return False
else :
return True
2.python 启动的脚本
os.system('ps aux | grep %s > %s' % (process, output))
&nbs
相关文档:
Python代码
import string, os, sys
dir = '/var'
print '----------- no sub dir'
files = os.listdir(dir)
for f in files:
......
1、相关命令:
ulimit –a //查看当前设置
ulimit –n 2048 //即设成2048,按实际需要设置
2、用户环境参数文件配置:
在/etc/profile中加入如下内容:
if
[ $SHELL
=
"
/bin/ksh
"
]; then
ulimit
-
p
16384
ulimit&nbs ......
linux shell pwd 显示当前路径
假若有test.cpp
g++ test.cpp -o test
./test
想在test中找到当前执行程序所在的路径
可以再test.cpp中使用readlink函数
具体见如下实例:
#include<iostream>
#include<unistd.h>
#include<dirent.h>
#include<string.h>
#include<string>
using ......
硬件技术一直和软件技术相依相随,随着服务器硬件和芯片技术的进步,推动着服务器操作系统技术的变革。
芯片技术的发展:从x86到龙芯
2009年,各大芯片厂商都推出了多款芯片产品:如Intel公司基于Nehalem架构发布的桌面端芯片产品酷睿i7;AMD公司也推出了基
于新Fiorano平台的代号为“伊斯坦布尔”的六 ......