版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/LuyaoYing001/article/details/79813745
- linux tar命令打包压缩文件不包含指定文件或目录
tar zcvf test.tar.gz test --exclude test/file1 --exclude test/data2
- 查看硬盘目录的占用情况
du -s -h ./*
出现空间释放不了的情况,如果发现du 和df 大小不一致的情况,可以通过lsof 查看,也许可以找到一些出现问题的原因,在允许的情况下不妨试一下重启服务。重启服务得不到解决的情况下,可以通过卸载磁盘分区来试着解决。在决定删除某些文件前,最好确定好这个文件被哪些服务使用,先停掉这些服务再删除。
- 定时任务crontab模板
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
0 0 * * * root python3 /data/py_example.py >> /log/out.log 2>&1
- 后台执行并输出到指定文件
nohup ./EXE >> log.out &
nohup sh some.sh >> log.out &