shell脚本入门
来源:互联网 发布:利拉德体测数据 编辑:程序博客网 时间:2024/04/28 18:28
1. shell获取当前时间并输出到文件中
myname=$(date +%Y-%m-%d_%H:%M:%S)
echo $myname >> a.txt
2.后台启动python脚本,关闭终端不退出
#!/bin/sh
ps -fe|grep api_change_email_notify |grep -v grep
if [ $? -ne 0 ]
then
python api_change_email_notify.py&
#echo "start api_change_email_notify success!"
#else
#echo "process exist"
fi
#####
3.获取当前shell的文件夹位置
http://blog.csdn.net/samxx8/article/details/51254546
basepath=$(cd `dirname $0`; pwd)
4. 执行字符串命令
#!/bin/bashpid=`ps -ef|grep api_change_email_notify.py|grep -v grep|awk '{print $2}'`if [ -z "$pid" ];then date=`date +%Y%m%d_%-H:%-M:%S` basepath=$(cd `dirname $0`; pwd) cmd="python ${basepath}/xxxx.py&" eval $cmd #echo "$date 未检测到api_change_email_notify,现在启动" >> /var/wd/api_manager/bin/pidtest.txtelse date=`date +%Y%m%d_%-H:%-M:%S` #echo "$date $pid" >> /var/wd/api_manager/bin/pidtest.txtfi
- linux shell 脚本入门
- linux shell脚本入门
- Linux: shell 脚本入门
- Korn Shell 脚本入门
- Shell脚本学习指南-入门
- linux shell 脚本入门
- shell脚本入门
- shell脚本入门
- shell脚本入门
- shell脚本入门
- shell-脚本入门
- Korn Shell 脚本入门
- shell脚本学习入门
- shell脚本---之入门
- Linux shell脚本入门
- Shell 脚本入门
- shell脚本编程入门
- shell脚本学习-入门
- git/github学习笔记
- hdu 2065 红色病毒
- I2c_test.c + i2c_dev.c +i2c_s3c3410.c 构成的i2c设备的调用链
- C#模拟键盘鼠标事件 SendKeys 的特殊键代码表
- python json,copy
- shell脚本入门
- spring3.1+hibernate3.6.5整合xml
- CVS使用手册
- Android 软件开发之数据的 新建 储存 读取 删除 详解(转)
- 对migor_ts.c的修改
- GDB十分钟教程
- ExtJs4学习笔记一--基础知识
- jquery 弹出层
- 挨踢项目求生法则-团队建设篇