首页 > 其他分享 >【crontab】使用cron每天定时签到掘金

【crontab】使用cron每天定时签到掘金

时间:2024-07-02 10:32:17浏览次数:1  
标签:run 签到 crontab month cron user day

一、场景

    每天自动掘金签到

 

 

二、crontab工具

usage:    crontab [-u user] file
    crontab [ -u user ] [ -i ] { -e | -l | -r }
        (default operation is replace, per 1003.2)
    -e    (edit user's crontab)
    -l    (list user's crontab)
    -r    (delete user's crontab)
    -i    (prompt before deleting user's crontab)
* * * * * command
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)
$ crontab -l
# Edit this file to introduce tasks to be run by cron.
# 
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
# 
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').
# 
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
# 
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
# 
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
# 
# For more information see the manual pages of crontab(5) and cron(8)
# 
# m h  dom mon dow   command

 

三、添加定时任务

输入crontab -e进入编辑模式

然后添加定时任务

 然后按下Ctrl + o,保存写入

 然后回车保存

 按住Ctrl +x离开

检查添加是否成功,可以使用crontab -l 查看

 

四、验证查看

 可以看到今日已签到

查看执行日志

journalctl -u cron.service

按下Shift+g调到最后

 或者,搜索使用 grep 搜索 cron 日志

grep CRON /var/log/syslog

 

参考链接:

https://blog.csdn.net/weixin_35757191/article/details/129084740

 

标签:run,签到,crontab,month,cron,user,day
From: https://www.cnblogs.com/fireblackman/p/18279396

相关文章

  • 推送标签到远程仓库的步骤
    推送标签到远程仓库的正确方式在软件开发中,标签(tag)是一种非常重要的工具,用于标记特定的版本或者里程碑。Git允许开发者在代码中创建和管理标签,并且可以将这些标签推送到远程仓库,例如GitHub,以便团队和用户能够方便地访问和使用特定版本的代码。步骤:创建标签首先,在本地仓库中......
  • 66Uptime – 网站服务器 & Cronjob 监控工具 v35.0.0扩展中文版安装
    66Uptime是一款自托管、易于使用、轻量级且高性能的网站服务器和Cronjob监控工具。以其丰富的功能和便捷的管理方式,为用户提供了全方位的网站服务器和Cronjob监控解决方案:主要功能:监控网站服务器和Cronjob的运行状态,确保它们持续稳定运行。提供从多个位置检查显示器的功......
  • SpringTask Cron表达式
    Cron表达式格式1.Cron表达式格式Cron表达式是一个字符串,字符串以5或6个空格隔开,分为6或7个域,每一个域代表一个含义,Cron有如下两种语法格式:秒分时一个月第几天月一个星期第几天年(1)SecondsMinutesHoursDayofMonthMonthDayofWeekYear(2)Seconds......
  • Hutool将Cron表达式转换为日期字符串
    在Java开发中,处理定时任务是常见的需求。Cron表达式是一种强大的工具,用于定义这些定时任务的执行时间。然而,有时我们需要将Cron表达式转换为具体的日期字符串,以便于展示或进一步处理。本文将介绍如何使用Hutool工具库来实现这一转换。准备工作在开始之前,确保你的项目中包含了......
  • vue3cron表达式
     引用:js部分importcmCronfrom'../../components/cmCron/index.vue';constshortcuts=[     {      text:"每天8点和12点(自定义追加)",      value:"008,12**?"     }    ]; 模板部分: ......
  • RHEL9 自动签到脚本 适用PT论坛
     浏览器打开开发者模式,网络筛选选择文档,刷新网站,把cookie全部复制出来,和当前的url组成一组字典,写入["cookie1"]["url1"]中,多个网页的话,后缀+1   替换cookie,url,proxy保存为sh文件,赋予执行权限chown-xqb.sh#!/bin/bashsleep10#预定义字典,包......
  • crontab设置计划任务
    crontab设置计划任务#设置定时任务crontab-e#或vim/etc/crontab#如每天晚上11点到早上7点之间,每小时执行一次/root/backup.sh脚本,并将输出内容导出到/var/backup_log.txt*23-7/1***root/root/backup.sh>>/var/backup_log.txt星号(*):代表所有可能的值,例如月份......
  • 在Linux中,如何进行调度任务?什么是 crontab 并解释 crontab 中的字段?
    在Linux中,调度任务通常指的是在预定的时间自动执行脚本或命令。cron(cronjob)是一种常用的任务调度工具,它按照设定的时间表周期性地执行任务。1.什么是crontab?crontab是一个配置文件,它包含了一个或多个cron任务的列表。每个任务都有一个特定的时间表,定义了任务何时执行。cro......
  • CronetDynamite.apk 中的奇怪崩溃(偏移量 0x1000) Android
    我的应用程序在2021年2月1日出现崩溃报告。崩溃LGELGPremierPro安卓9(SDK28)Playstore控制台崩溃已在CronetDynamite.apk中报告了40次backtrace:......
  • Linux 提权-Cron Jobs
    本文通过Google翻译CronJobs–LinuxPrivilegeEscalation-Juggernaut-Sec这篇文章所产生,本人仅是对机器翻译中部分表达别扭的字词进行了校正及个别注释补充。导航0前言1什么是CronJob?1.1了解Crontabs和Cron目录1.2如何在Crontab文件中读取Cron......