公告:    欢迎来到王者★孤傲博客主页,若有问题敬请留言 !     没有大量的积累和感悟,是不会把事情做好的, 只有不停的进取,才能够不丢人! Copyright © 2016-2020 RaodiBlogs. All rights reserved.

数据仓库005 - 复习Linux shell命令 - crontab调度 sh脚本 后台执行 软连接

 


一、crontab调度  

  对于linux 自带crontab而言,      xxx.sh的一般编写格式以#!/bin/bash 解释器开头,可在脚本中加入:

date

  但是,shell脚本执行 需要 x权限,执行的方式如下:

  ./xxx.sh
  sh ./xxx.sh

  其中,后缀.sh 第一行#!/bin/bash 没有,需要使用sh命令去执行

 

1、crontab简单调度

复制代码
[root@localhost ~]# crontab -e
no crontab for root - using an empty one
* * * * * /root/test.sh >> /root/test.log



#执行
[root@localhost ~]# crontab -l
* * * * * /root/test.sh >> /root/test.log
[root@localhost ~]# crontab -l
* * * * * /root/test.sh >> /root/test.log
[root@localhost ~]# 
复制代码

其中,  

* * * * * 分别代表了分、小时、日、月、周、

    */6 */1=*
    * 代表 每

面试题: 每隔10s执行一次

复制代码
[root@localhost ~]# cat test1.sh 
#!/bin/bash
for((i=1;i<=6;i++));
do

date
sleep 10s

done

exit
[root@localhost ~]# sh test1.sh 
2019年 11月 22日 星期五 02:53:18 CST
2019年 11月 22日 星期五 02:53:28 CST
2019年 11月 22日 星期五 02:53:38 CST
复制代码

 

 

 

2.后台执行

  ./test.sh &
  nohup ./test.sh & 手动启动脚本 看日志 开发维护 测试
  nohup ./test.sh > /root/test.log 2>&1 & 生产上

 

 

二、软连接

[root@localhost ~]# ll
total 4
drwxr-xr-x 2 root root 6 Nov 20 21:33 mysql5.6 
drwxr-xr-x 2 root root 6 Nov 20 21:33 mysql5.7 
drwxr-xr-x 3 root root 44 Nov 17 23:13 ruozedata
-rw-r--r-- 1 root root 846 Nov 17 23:12 ruozedata.zip
[root@localhost ~]#

  ln -s 原path 目标path

 

     CDH升级 原文件不见了 光标跳动:
  找原文件文件夹;
  删除快捷键文件文件夹--》重新做新的软连接 高版本

 

 

posted @   王者★孤傲  阅读(6322)  评论(0编辑  收藏  举报
编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· 展开说说关于C#中ORM框架的用法!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
亲亲ლ(°◕‵ƹ′◕ლ), 早上好,早起的鸟儿有虫吃噢!早起的虫儿被鸟吃,你是鸟儿还是虫儿?嘻嘻!
点击右上角即可分享
微信分享提示