shell: logging + readlog
- logging
#!/bin/bash
# a small tool for logging sommething
#
# 1. read your input
# 2. save to logs file >> ~/logs/$(date +%F)
#
# if command like: logging something
# do echo something >> ~/logs/$(date +%F)
cd ${HOME} || {
echo "no HOME variable!"
exit
}
mkdir -p .logs
logDir='.logs'
if [ $# -gt 0 ] ; then
echo "$(date +%T) $@" >> $logDir/$(date +%F)
else
read -p "好记性不如烂笔头,please input info: " info
echo "$(date +%T)" $info >> $logDir/$(date +%F)
fi
## if faild, output
[ $? -eq 0 ] || echo "logging failed"
- readlog
#!/bin/bash
[ $# -gt 1 ] && {
echo "usage: $0 [-1]"
exit
}
if [ $# -eq 0 ] ; then
date_file=$(date +%F)
else
date_file=$(date +%F --date="$1 day")
fi
vim ${HOME}/.logs/$date_file
shell: logging + readlog的更多相关文章
- Python logger /logging
# !/user/bin/python # -*- coding: utf-8 -*- ''' subprocess : 需要在linux平台上测试 shell logging ''' import ...
- the usage of linux command "expect"
#! /usr/bin/expect -f# this script is used to practise the command "expect" #when "li ...
- RHive
R + Hive = RHive 支持原创:http://blog.fens.me/nosql-r-hive/ R利剑NoSQL系列文章 之 Hive Hive介绍 Hive安装 RHive安装 RH ...
- Python logger 没打出行数
# !/user/bin/python # -*- coding: utf-8 -*- ''' subprocess : 需要在linux平台上测试 shell logging ''' import ...
- 【转】Hive安装及使用攻略
Posted: Jul 16, 2013 Tags: HadoophiveHiveQLsql分区表 Comments: 18 Comments Hive安装及使用攻略 让Hadoop跑在云端系列文章, ...
- 转】R利剑NoSQL系列文章 之 Hive
原博文出自于: http://blog.fens.me/category/%E6%95%B0%E6%8D%AE%E5%BA%93/page/3/ 感谢! Posted: Jul 27, 2013 Ta ...
- Shell script for logging cpu and memory usage of a Linux process
Shell script for logging cpu and memory usage of a Linux process http://www.unix.com/shell-programmi ...
- s14 第5天 时间模块 随机模块 String模块 shutil模块(文件操作) 文件压缩(zipfile和tarfile)shelve模块 XML模块 ConfigParser配置文件操作模块 hashlib散列模块 Subprocess模块(调用shell) logging模块 正则表达式模块 r字符串和转译
时间模块 time datatime time.clock(2.7) time.process_time(3.3) 测量处理器运算时间,不包括sleep时间 time.altzone 返回与UTC时间 ...
- shell常用命令之curl: -w,–write-out参数详解
顾名思义,write-out的作用就是输出点什么.curl的-w参数用于在一次完整且成功的操作后输出指定格式的内容到标准输出. 输出格式由普通字符串和任意数量的变量组成,输出变量需要按照%{varia ...
- Spark Shell & Spark submit
Spark 的 shell 是一个强大的交互式数据分析工具. 1. 搭建Spark 2. 两个目录下面有可执行文件: bin 包含spark-shell 和 spark-submit sbin 包含 ...
随机推荐
- 使用select需要注意的细节
使用select需要注意的细节 在学校的时候就使用过select,但是在项目中使用的时候却犯了个错误. select如何使用就不进行总结了,网上教程太多,以下是项目中我写的一小段代码,便于总结. in ...
- [Pytorch框架]3.2 MNIST数据集手写数字识别
文章目录 3.2 MNIST数据集手写数字识别 3.2.1 数据集介绍 3.2.2 手写数字识别 3.2 MNIST数据集手写数字识别 import torch import torch.nn as ...
- lombok版本报错问题java.lang.IllegalAccessError: class lombok.javac.apt.LombokProcessor (in unnamed module
lombok版本报错问题 记录一个项目部署时遇到的问题,我本地采用的JDK8的版本,然后我的服务器采用的是JDK17,然后在用maven进行打包的时候,发现package失败. 复现 我在本地采用的l ...
- SpringBoot集成Jpa对数据进行排序、分页、条件查询和过滤
之前介绍了SpringBoot集成Jpa的简单使用,接下来介绍一下使用Jpa连接数据库对数据进行排序.分页.条件查询和过滤操作.首先创建Springboot工程并已经继承JPA依赖,如果不知道可以查看 ...
- Vue2到Vue3的改变
一.Vue2->Vue3 如果有Vue2的基础,并在此基础上学习Vue3,并不需要把完整的官网看完,我们只需要关注一下新功能和非兼容的变化即可进行开发. 二.Vue3变化 统一元素上使用的v-i ...
- 2023-02-22:请用go语言调用ffmpeg,保存mp4文件的视频帧,每帧用ppm图片保存。
2023-02-22:请用go语言调用ffmpeg,保存mp4文件的视频帧,每帧用ppm图片保存. 答案2023-02-22: 使用 github.com/moonfdd/ffmpeg-go 库. 先 ...
- Module build failed: Error: Plugin/Preset files are not allowed to export objects, only functions.
运行项目是提示Module build failed: Error: Plugin/Preset files are not allowed to export objects, only funct ...
- web自动化05-鼠标操作
鼠标操作方法 1.常见的鼠标操作 点击.右击.双击.悬停.拖拽等 2.selenium中的封装鼠标操作 说明:在Selenium中将操作鼠标的方法封装在ActionChains类中 ...
- 代码随想录算法训练营Day24 回溯算法| 理论基础 77. 组合
代码随想录算法训练营 回溯 什么是回溯法 回溯法也可以叫做回溯搜索法,它是一种搜索的方式. 在二叉树系列中,我们已经不止一次,提到了回溯,例如二叉树:以为使用了递归,其实还隐藏着回溯. 回溯是递归的副 ...
- Linux 下 R 源码安装指南
本文章同步自作者的语雀知识库,请点击这里阅读原文. 如果你使用的 Linux 系统 GCC 版本太低, 又没有 root 权限 (即使有 root 权限又担心升级 GCC 带来的风险) ; 同时你又不 ...