1.Java调用shell Java语言以其跨平台性和简易性而著称,在Java里面的lang包里(java.lang.Runtime)提供了一个允许Java程序与该程序所运行的环境交互的接口,这就是Runtime类,在Runtime类里提供了获取当前运行环境的接口.其中的exec函数返回一个执行shell命令的子进程.exec函数的具体实现形式有以下几种:public Process exec(String command) throws IOExceptionpublic Process e…
Linux shell 操作 postgresql:删除间隔日期的数据-删除指定日期的数据-vacuumdb 清理数据库 -清理日志 -定期执行脚本 *修改pg_hba.conf 设置本地连接无密码,trust # "local" is for Unix domain socket connections only local all all trust # IPv4 local connections: host all all 127.0.0.1/32 trust crontab…
原文地址:http://www.sohu.com/a/138822796_610671 首先,我们从一个十分简单的例子test.sh开始吧: #!/bin/sh #this is a test. cd /tmp echo "hello,this is a test" 这是一个十分简单的程序,但是运行结果可能会让你吃惊哦! 这个时候,我们发现程序运行之后,并没有改变当前目录.(黑人问号???) 别着急,我们先了解一下linux程序如何运行. linux程序三种执行方法 运行linux程序…
由于需要,需要将一系列mysql的操作制作成.sh文件,只需要shell操作bash命令就可以傻瓜式的完成黑盒任务. #!/bin/bash mysql -uroot -p??? -e "create database IF NOT EXISTS test_db_test" mysql -uroot -p??? -e "use test_db_test;create table IF NOT EXISTS test_table_test ( name varchar(20),…