- 浏览: 37308 次
- 性别:
- 来自: 北京
最新评论
文章列表
[root@test logs]# cat a.cfg
#!/bin/bash
username=oracle
oracle_1=aa
oracle_2=bb
oracle_3=cc
[root@test logs]# cat a.sh
#!/bin/bash
. ./a.cfg
typeset name=oracle
for i in `echo "1 2 3"`
do
eval dbname='$'${name}_${i}
echo $dbname
done
管道和tee使用时获取前面命令返回值
- 博客分类:
- shell小技巧
[root@test output]# cat a.sh
#!/bin/sh
a=3
if [ $a -gt 4 ]
then
echo "1111111"
exit 1
fi
echo "222222"
exit 0
[root@test output]# cat b.sh
#!/bin/sh
sh a.sh | tee >>a.log
aa=${PIPESTATUS[0]}
if [ $aa -ne 0 ]
then
echo "aaaaaaaaaaaaaaaa"
fi
oracle@linux:~/cc> cat a.txt
111
222
333
444
555
666
oracle@linux:~/cc> cat b.txt
111
222
333
444
555
aaa
oracle@linux:~/cc> grep -Fxv -f a.txt b.txt
aaa
pymongo 中自增列设置
- 博客分类:
- python
1、在mongodb中可以采用js函数方法设置
> db.createCollection("counters")
{ "ok" : 1 }
> db.counters.insert({_id:"userid",sequence_value:0})
WriteResult({ "nInserted" : 1 })
> db.counters.find()
{ "_id" : "userid", "sequence_value&quo ...
python test4
- 博客分类:
- python
if len(sys.argv) == 3:
parser.add_argument('-O', action='store_true', default=False, help='FILE exists and is owned by the effective user ID')
parser.add_argument("x", type=str, help="File1")
args = parser.parse_args()
x = args.x
...
def main():
usage = 'test - check file types and compare values'
parser = argparse.ArgumentParser(usage)
parser.add_argument('-b', action='store_true', default=False, help='FILE exists and is block special')
parser.add_argument('-c', action='store_true', default=False, ...
python test2
- 博客分类:
- python
# two param
# -nt
def isNewthan(x, y):
t1 = int(os.stat(x).st_ctime)
t2 = int(os.stat(y).st_ctime)
if t1 > t2:
return 0
else:
return 1
# -ot
def isOlderthan(x, y):
t1 = int(os.stat(x).st_ctime)
t2 = int(os. ...
python test1
- 博客分类:
- python
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import sys, os, stat
import argparse
# -b
def isBlockfile(x, y):
stf = os.stat(x)
mode = stf.st_mode
if stat.S_ISBLK(mode):
return 0
else:
return 1
# -c
def isCharspecial(x, y):
stf = os.stat(x)
...
python cat
- 博客分类:
- python
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import sys, os
import argparse
import re
def showprintings(f,endchar,showNum=False):
max_len = 4096
num = 0
prog = re.compile('\t')
prog2 = re.compile('\r\n')
if not os.path.isfile(f):
print("{}: not ...
python冒泡排序
- 博客分类:
- python
def bubbleSort(numbers):
for j in xrange(len(numbers) - 1, -1 , -1):
for i in xrange(j):
if numbers[i] > numbers[i + 1]:
numbers[i], numbers[i + 1] = numbers[i + 1], numbers[i]
def main():
numbers = [12, 34, 3, 56, 399, 39, 28]
bubbleSort(numbers)
if __name__ == ' ...
oracle锁表处理
- 博客分类:
- oracle
select * from v$locked_object; /*查看被锁的表*/
select l.oracle_username User_name,
o.owner,
o.object_name,
o.object_type,
s.sid,
s.serial# /*查谁在锁表-.-*/
from v$locked_object l, dba_objects o, v$session s
where l.object_id = o.object_id
and l.session_id = s.sid
order by o.object_id desc;
alter system kill ...
linux 限制root telnet登陆
- 博客分类:
- 操作系统
当用root使用telnet登陆到服务器时出现以下错误:
Welcome to SUSE Linux Enterprise Server 11 SP1 (x86_64) - Kernel 2.6.32.45-0.3.2.3813.0.PTF-default (6).
OneSDP178 login: root
Login incorrect
修改方法:
OneSDP178:/etc # vi securetty
OneSDP178:/etc # mv securetty securetty.bak
1 ftp配置问题:
1.1 常用ftp启动方式:
1.1.1 vsftp:
#/etc/init.d/vsftpd start|stop|status|restart
或者
#service vsftpd start|stop|status|restart
1.1.2 pure-ftp:
#/etc/init.d/pure-ftpd start|stop|status|restart
或者
#service pure-ftpd start|stop|status|restart
在Suse环境中还 ...
oracle 总结:
1. 用于查看客户端ip
select sys_context('userenv', 'ip_address') from dual;
2. 获取系统guid
select sys_guid() from dual;
3. 查看锁表
select * from v$locked_object;
select * from user_objects u where u.object_id='80025';
4. 删除触发器语句
-- Created on 2012-7-23 by LKF47688
declare
-- Local variables ...