Linux定时使用find查找过期备份或缓存文件并删除

Centos系统测试

查找命令语句写法:
find 对应目录 -name “文件名”  -mtime +天数  -exec rm -rf {} \ ;  -print

当然也可以使用
find 对应目录 -name “文件名” type f  -mtime +天数  -exec rm {}  \;  -print
加-print 是调试的时候使用的,应用时可以去掉

find 对应目录 -name “文件名” type f  -mtime +天数  -exec rm {}  \;  -print > /data/log.txt 某文件路径 把执行结果输出到文件

再后用使用crontab -e来定时执行以上命令 把代码写入sh文件
或者编辑 /etc/crontab

格式
* * * * * – – – – – 执行的程序
| | | | |
| | | | +—– day of week (0 – 6) (Sunday=0)
| | | +——- month (1 – 12)
| | +——— day of month (1 – 31)
| +———– hour (0 – 23)
+————- min (0 – 59)

t1  t2  t3  t4  t5  program

t1:表示分钟,取值(0-59)。

t2:表示小时,取值(0-23)。

t3:表示日期,取值(1-31)。

t4:表示月份,取值(1-12)。

t5:表示星期,取值(0-6),0是星期天。

还有几个特殊的符号:“*”,“/”,“-”。“*”表示所有取值范围内的数字,“/”表示每的意思,比如在分钟上 */2 ,表示每两分钟,“-”表示从某个数字到某个数字。

由于crontab是个全局命令,因此可以在任何目录下操作crontab。

具体使用也是很简单的 每周六、周日的1 : 1 0执行一次命令

10 1 * * 6,0 /bin/bash *.sh文件

发表在 服务器 | 标签为 , , , | 留下评论

linux bash:命令: command not found

[root@localhost bin]# mysqladmin -u root password 123456
bash: mysqladmin: command not found
因为你的mysqladmin命令的路径在/usr/local/mysql/bin下面,所以你直接使用mysql命令时,系统在/usr/bin下面查此命令,所以找不到了,
解决办法

1:命令前面加./表明在当前目录执行或搜索

2: 用ln -s /usr/local/mysql/bin/mysql /usr/bin 做个链接即可

3:通过直接指定命令完整路径来执行 如/usr/local/mysql/bin/mysqladmin

发表在 服务器 | 标签为 , , , | 留下评论

VB6.0支持鼠标滚轮的方法

最近帮德行的人写个操作Excel的程序,开始用VBA写完代码,然后要移植到VB中。

VB中的编辑器真是不支持滚轮。不过微软还是提供了相应的补丁。

下载 VB 6 鼠标 Wheel.exe 文件, 包括加载 DLL 和代码用于创建加载项 DLL。 1.下载 VB 6 鼠标 Wheel.exe 文件,应运行。 可用于从 Microsoft 下载中心下载下列文件:

  DownloadDownload the VB6MouseWheel.EXE package now.

http://download.microsoft.com/download/e/f/b/efb39198-7c59-4ace-a5c4-8f0f88e00d34/vb6mousewheel.exe

  2.单击 开始,单击 运行,键入 regsvr 32  路径\VB6IDEMouseWheelAddin.dll 。

(建议把VB6IDEMouseWheelAddin.dll 直接COPY到系统文件夹下,这样可以直接运行regsvr32 VB6IDEMouseWheelAddin.dll )

  3.启动 Visual Basic 6.0。

  4.单击加载项,然后单击 加载项管理器(外接程序管理器)

  5.在加载项管理器列表, 单击 MouseWheel fix 。

  6.在available add-ins列表中,选择“mousewheel fix”,在load behavior栏中单击选中”loaded/unloaded和load on startup复选框

  7.单击 确定 。

发表在 软件 | 标签为 , , | 2条评论

sql server 2000通过php转换导入mysql数据 ntext类型问题

php读取mssql2000转换数据的时候,发现ntext类型字段反回值为空或者出现错误“message: 不能用 DB-Library(如 ISQL)或 ODBC 3.7 或更早版本将 ntext 数据或仅使用 Unicode 排序规则的 Unicode 数据发送到客户端。”,建议可以把ntext字段改成 text。

例如: convert(text,content) as content

这样还不够,在windows下虽然转换过程不会出现错误提示,但是很以后可能出现数据被截流了,少了一部分。

这时候需要修改 php.ini

找到:;mssql.textlimit = 4096 改为:mssql.textlimit = 2147483647

找到:;mssql.textsize = 4096  改为:mssql.textsize = 2147483647

 尽量修改为最大,确保转换数据完整。

发表在 数据库 | 标签为 , , , , , | 留下评论

phpMyAdmin调整session时间 登陆超时1440秒未活动问题

phpmyadmin在使用过程中经常出现“登陆超时(1440秒未活动),请重新登录” session超时。

解决方法如下:

首先:修改php.ini中的session.gc_maxlifetime = 1440,将数值进行调整。

接着:修改配置文件config.default.php中的$cfg[‘LoginCookieValidity’] = 1440,将1440对应进行调整。

注意:$cfg[‘LoginCookieValidity’]中的修改值不能大于php.ini里的session.gc_maxlifetime的值,否则phpmyadmin 里会直接出现登录错误。

发表在 开源代码 | 标签为 , | 留下评论

域名转移码 ICANN投诉网址和范文

ICANN 投诉地址:http://reports.internic.net/cgi/registrars/problem-report.cgi

范文1
Hello,I regesiter xxxx.com and xxxx.com from HICHINA ZHICHENG TECHNOLOGY LTD.
I am not satisfied with their services.And I want to transfer my domains to name.com.
From April 20th,2009,I have do everything as they tell me to do.I have send my goverment ID card copy to them.
And I have give a lot of phones to them.Everytime they say I will receive my auth code soon.But everytime I login in my email-”xxxx@xxxx.com”,I still couldn’t receive the auth codes.
They limited the user transfer the domain particularly seriously.I have waste about one mothes but I still can’t receive my auth code.
Today they want me to wait for 60 days and continu to begin the transfer again.
They don’t give me the auth codes to transfer the domain.Please!Please!Do please help me tarnsfer my domain.HICHINA is a very bad domain registrar.

范文2
This is a Domain Name Complaint letter about HiChina Registrar I send 3nd times. I’m the domain owner of xxxxxx, wanna transfer domains registrar from HiChina (HiChina Zhicheng Technology Limited, www.net.cn) to GoDaddy.com, Inc.

But after I submit information include photocopy of id card & passport and comfirm they recieved (by telephone). HICHINA refuse to processed the transfer, the reason is the application form is not completely. Actually I submit 2 times to meet their request.

First time: Around 23rd, Dec 2008 I sent application form and photocopy of my ID card. They replay me that there is a reqest item i left empty and no signature;

Second time: Around 8th, Feb 2009 I sent application form with signature and completely all item attached photocopy of my passport (by HiChina’s request). But they still refuse with same reason. I don’t know how can I do to meet the request.

I feel that is irresponsible action and it break the iccan domain policy for nosense reason. I need your help.

范文3
To Iccan administrator:
Dear ICCAN administrator,happy new year.
This is a Domain Name Complaint letter about Changing Registrars,I’m the domain owner, wanna tranfer some domain Registrar from HICHINA WEB SOLUTIONS (HONG KONG) LIMITED to enom
(xxx.com,xx.net,xx.com,xx.com,xxxx.com…)
But after i submit ems info to them and confirm they receving(by email and telephone),HICHINA refuse to proceed the process and then have no response.
I feel that’s irresponsible action and it break the iccan domain Policy for nonsense reason.I need your help.
my agent id:xxx,name xxx,thanks a lot.
server info:
Domain Name: xxx
Registrar: HICHINA WEB SOLUTIONS (HONG KONG) LIMITED
Whois Server: grs.hichina.com
Referral URL: http://whois.hichina.com

发表在 服务器 | 标签为 , , , , | 留下评论

dedecms php标签内获取外部字段值

利用global来实现

在同一个模板中可以利用全局变量传值

先用全局变量保存起来

{dede:field.id runphp=’yes’}

global $value;

$value=@me;

{/dede:field.id}

再调用

{dede:field.typename runphp=’yes’}

@me.=$GLOBALS[‘value’];

{/dede:field.typename}

发表在 开源代码 | 标签为 , , , | 留下评论

dedecms织梦修改成使用静态或动态浏览的方式

在后台系统设置mysql里或phpmyadmin执行查询命令:

将所有文档设置为“仅动态”,update dede_archives set ismake=-1

将所有栏目设置为“使用动态页”,update dede_arctype set isdefault=-1

语句上的-1改成1就是使用静态的方式了。

动态转换为静态后需要重新生成HTML才能访问。

发表在 开源代码 | 标签为 , , | 留下评论

PHPCMS忘记后台管理员密码的修改方法

把这段代码写在一个php文件内,放在根目录下访问这个文件就可以了。

很简单吧。
<?php
include ‘./include/common.inc.php’;
$username =’用户名’;
$password = ‘密码;
$password = md5(PASSWORD_KEY.$password);
$db->query(“UPDATE “.DB_PRE.”member SET password = ‘$password’ WHERE username = ‘$username'”);
$db->query(“UPDATE “.DB_PRE.”member_cache SET password = ‘$password’ WHERE username = ‘$username'”);
echo ‘修改成功’;
?>
 
发表在 开源代码 | 标签为 , , | 留下评论

mysql批量删除相同前缀表名的数据表

使用php代码:

<?php
mysql_connect(”,”,”);
mysql_select_db(”);
$rs=mysql_query(‘show tables’);

while($arr=mysql_fetch_array($rs)){
    $TF=strpos($arr[0],’class_’);
    if($TF===0){
        $FT=mysql_query(“drop table $arr[0]”);
        if($FT){
            echo “$arr[0] 删除成功!<br>”;
            }
        }
    }

?>

<?php
$hostname =’localhost’;
$userid = ‘username’;
$password = ‘password’;
$dbname = ‘dbname’;
$connect = mysql_connect($hostname,$userid,$password);
mysql_select_db($dbname);
$result = mysql_query(“show table status from $dbname”,$connect);
while($data=mysql_fetch_array($result)) {
mysql_query(“drop table $data[Name]”);
}
?>

通过phpmyadmin批量删除

一、先说一下简单的批量删除特定前缀(其实有特定字符串的都可以)的表:

1、在phpmyadmin中运行如下sql命令:

Select CONCAT( ‘drop table ‘, table_name, ‘;’ )
FROM information_schema.tables
Where table_name LIKE ‘cdb_%’;

说明:information_schema是系统数据库,这个数据库里有一个叫table的表,表里的内容是当前登录用户权限内可以看见的所有数据库的表名,一个表名占一行。CONCAT是连接字符串。上面语句的作用是生成一批删除指定前缀(cdb_)的表的sql语句。类似:
drop table cdb_aaa;
drop table cdb_bbb;

2、复制上面的内容,进入需要删除表的数据库,粘帖到sql运行框内,执行。
注意,在产生批量删除的sql语句的时候,可能有些字符显示不下(表名太长)。点击该页面的“选项”,里面勾选“完整文字”即可。

二、批量修改表名

1、在phpmyadmin中运行如下sql命令:

Select CONCAT( ‘ALTER TABLE ‘, table_name, ‘ RENAME TO ‘, table_name,‘;’ )
FROM information_schema.tables
Where table_name LIKE ‘cdb_%’;

得到结果:
ALTER TABLE cdb_aaa RENAME TO cdb_aaa;
ALTER TABLE cdb_bbb RENAME TO cdb_bbb;

2、复制上面的结果到记事本,寻找RENAME TO cdb批量替换成RENAME TO pre(将cdb前缀改成pre前缀)
3、再复制记事本的内容,粘帖到phpmyadmin的sql运行框内,执行。

ps:上面的方法说方便也不是太方便,如果要改的表少的话还是手工改快一点。

发表在 数据库 | 标签为 , | 留下评论