Skip to main content

Finding Cronjobs created for 1 and 5 min

Comments

3 comments

  • cPRex Jurassic Moderator
    Hey there! If I'm reading that script properly, it looks like this will already do this for you. That script is already detecting any cron that runs in 1, 2, 3, 4, or 5 minute intervals. We can see this from the following lines: mn=$(echo ${entry}|awk -F':' '{print $1}'); That pulls the first column, which is the time. And then this: if [[ ${mn} == "*" || ${mn} =~ "\*\/[0-5]$" ]]; Which gives you output if there is anything with the numbers 1 through 5 in that first column. So you should not need to do anything additional to get crons that are set for ever 5 minutes on the machine.
    0
  • Vs Nu
    Hey there! If I'm reading that script properly, it looks like this will already do this for you. That script is already detecting any cron that runs in 1, 2, 3, 4, or 5 minute intervals. We can see this from the following lines: mn=$(echo ${entry}|awk -F':' '{print $1}'); That pulls the first column, which is the time. And then this: if [[ ${mn} == "*" || ${mn} =~ "\*\/[0-5]$" ]]; Which gives you output if there is anything with the numbers 1 through 5 in that first column. So you should not need to do anything additional to get crons that are set for ever 5 minutes on the machine.

    If i change [0-15] will it show crons of 15 min ?
    0
  • cPRex Jurassic Moderator
    That's correct.
    0

Please sign in to leave a comment.