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
相关文档:
例一:发送Signaling Packet:
Signaling Command是2个Bluetooth实体之间的L2CAP层命令传输。所以得Signaling Command使用CID 0x0001.
多个Command可以在一个C-frame(control frame)中发送。
如果要直接发送Signaling Command.需要建立SOCK_RAW类型的L2CAP连接Socket。这样才有机会自己填充Command Code,Identi ......
Python代码
import string, os, sys
dir = '/var'
print '----------- no sub dir'
files = os.listdir(dir)
for f in files:
......
系统要求:
内存:推荐1G
Swap分区:设为内存的2倍
/tmp磁盘空间:400MB以上三
磁盘空间:软件3.5G 数据1.2G
所需软件:
SuSE Linux10 for x86
Oracle database 10gR2 for Linux32
Orarun-1.8-109.15.i586.rpm软件包,可以从http://Ftp.novell.com/partners/Oracle/sels-9下载
&n ......
一、说明
类似Windows系统中的动态链接库,Linux中也有相应的共享库用以支持代码的复用。Windows中为*.dll,而Linux中为*.so。下面详细介绍如何创建、使用Linux的共享库。
二、创建共享库
在mytestso.c文件中,代码如下:
#include <stdio.h>
#include <stdlib.h>
int GetMax(int a, int b)
{
i ......
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 ......