linux 定时任务 crontab更改当前用户

1、参考

CentOS 7 定时任务 crontab 入门

Centos 利用crontab定时执行任务及配置方法

2、

crontab -l
crontab -e


# prod backup database
# 0 2 * * *  cd /data/xxxxx && /usr/bin/sh yy_backup.sh
# prod auto update manage code
# * * * * *  cd /data/xxxxx/      && source /etc/profile && /usr/bin/sh yy_auto_update_manage.sh
# temp auto update manage code
# * * * * *  cd /data/xxxxx_temp/ && source /etc/profile && /usr/bin/sh yy_auto_update_manage.sh
# temp auto update spring service
# * * * * *  cd /data/xxxxx_temp/ && source /etc/profile && /usr/bin/sh yy_auto_update.sh
# y4_kkk auto update
# * * * * *           cd /data/y4_kkk/ && source /etc/profile && /usr/bin/sh au-auto-update.sh
# * * * * * sleep 10; cd /data/y4_kkk/ && source /etc/profile && /usr/bin/sh au-auto-update.sh
# * * * * * sleep 20; cd /data/y4_kkk/ && source /etc/profile && /usr/bin/sh au-auto-update.sh
# * * * * * sleep 30; cd /data/y4_kkk/ && source /etc/profile && /usr/bin/sh au-auto-update.sh
# * * * * * sleep 40; cd /data/y4_kkk/ && source /etc/profile && /usr/bin/sh au-auto-update.sh
# * * * * * sleep 50; cd /data/y4_kkk/ && source /etc/profile && /usr/bin/sh au-auto-update.sh

# prod yy_new backup database
0 2 * * *  cd /data/yy_new && /usr/bin/sh db_backup_yy_new.sh


/bin/systemctl restart crond.service
posted @ 2023-06-18 21:50  一只桔子2233  阅读(221)  评论(0编辑  收藏  举报