Solved

Adjusting Cron Jobs ?

Posted on 2011-02-21
9
1,400 Views
Last Modified: 2012-05-11
I am trying to edit this cron job to execuit every 30 days because I am getting to many alurts evey 8 hrs from what it is showing me

0 8,20 * * * /root/rkhunter.sh

now I tried
crontab -e

Then I went to that line and put
0 0,30 * * * /root/rkhunter.sh

When I went to save it gave me the below error

"/tmp/crontab.XXXXdksuZh":3: bad hour
errors in crontab file, can't install.
Do you want to retry the same edit?
Enter Y or N

clear                                                          root@server [~]# crontab -l
0 4 * * * /usr/sbin/cxs --upgrade --quiet
0 8,20 * * * /root/chkrootkit.sh | grep -v .packlist
0 8,20 * * * /root/rkhunter.sh

0 1 * * * /root/mysql.sh > /dev/null 2>&1
8,23,38,53 * * * * /usr/local/cpanel/whostmgr/bin/dnsqueue > /dev/null 2>&1
*/5 * * * * /usr/local/cpanel/bin/dcpumon >/dev/null 2>&1
2,58 * * * * /usr/local/bandmin/bandmin
0 0 * * * /usr/local/bandmin/ipaddrmap
26 3 * * * /usr/local/cpanel/whostmgr/docroot/cgi/cpaddons_report.pl --notify
36 6 * * * cd /usr/local/cpanel/whostmgr/docroot/cgi/fantastico/scripts/ ; /usr/local/cpanel/3rdparty/bin/php-cgi cron.php > /dev/null 2>&1


10 7 * * * cd /usr/local/assp;perl /usr/local/assp/rebuildspamdb.pl
MAILTO=""
*/59 * * * * /usr/local/cpanel/3rdparty/bin/php-cgi /usr/local/assp/deluxe/ex_localdomains.php clean_logs=yes daniolo=yes
*/3 * * * * /usr/local/cpanel/3rdparty/bin/php-cgi /usr/local/assp/deluxe/update_email.php
*/3 * * * * /usr/local/cpanel/3rdparty/bin/php-cgi /usr/local/assp/deluxe/status.php long=1 daniolo=yes
*/4 * * * * /usr/local/cpanel/3rdparty/bin/php-cgi /usr/local/assp/deluxe/spam_cronjob.php high=7
10 8 * * * /usr/local/cpanel/3rdparty/bin/php-cgi /usr/local/assp/deluxe/clear_spambox.php sday=3 sp=yes limitspace=10000 remdays=1
*/20 * * * * /usr/local/cpanel/3rdparty/bin/php-cgi /usr/local/assp/deluxe/find_abusers.php sw=7 sc=8 er=13 lm=13 dc=8 rl=20 dn=1 on=1
*/27 * * * * /usr/local/cpanel/3rdparty/bin/php-cgi /usr/local/assp/deluxe/find_abusers.php show=2 sc=2 dm=file er=6 lm=4 dc=2 on=1
0 9 * * * /usr/local/cpanel/3rdparty/bin/php-cgi /usr/local/assp/deluxe/signatures.php
2 */6 * * * /usr/sbin/exiqgrep -o 16800 -i | /usr/bin/xargs /usr/sbin/exim -Mrm
MAILTO=""
30 */4 * * * /usr/bin/test -x /scripts/update_db_cache && /scripts/update_db_cache
45 */8 * * * /usr/bin/test -x /usr/local/cpanel/bin/optimizefs && /usr/local/cpanel/bin/optimizefs
0 1 * * * /scripts/cpbackup
35 * * * * /usr/bin/test -x /usr/local/cpanel/bin/tail-check && /usr/local/cpanel/bin/tail-check
30 */2 * * * /usr/local/cpanel/bin/mysqluserstore >/dev/null 2>&1
15 */2 * * * /usr/local/cpanel/bin/dbindex >/dev/null 2>&1
11 4 * * * /usr/bin/freshclam --quiet --no-warnings
0 5 * * * /scripts/upcp
0 6 * * * /scripts/exim_tidydb > /dev/null 2>&1
root@server [~]#

Open in new window

0
Comment
Question by:sobeservices2
  • 4
  • 4
9 Comments
 
LVL 19

Accepted Solution

by:
simon3270 earned 500 total points
ID: 34946940
crontab lines are
minutes hour day month weekday command

so for once a month, you could have

0 20 2 * * /root/rkhunter.sh

which would run the command at 8pm on the second of every month.

If you wanted it weekly, you could run it every Sunday (day zero)

0 20 * * 0 /root/rkhunter.sh

or every Monday

0 20 * * 1 /root/rkhunter.sh

For each of the above, you can set the time to whatever suits you best (I just picked 8pm because it was one of the times in your original line).
0
 

Author Comment

by:sobeservices2
ID: 34946977
Thanks .. I will give it a try in a few something just came up.
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 34948465
30 is an invalid hour. you need to play with the next filed which is for days of the month
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

Author Comment

by:sobeservices2
ID: 34951738
I put everything to just * for this line below and I am still getting cron reports

as follows how can I disable these too many

[ Rootkit Hunter version 1.3.8 ]

Checking rkhunter data files...
  Checking file mirrors.dat                                  [ No update ]
  Checking file programs_bad.dat                             [ No update ]
  Checking file backdoorports.dat                            [ No update ]
  Checking file suspscan.dat                                 [ No update ]
  Checking file i18n/cn                                      [ No update ]
  Checking file i18n/de                                      [ No update ]
  Checking file i18n/en                                      [ No update ]
  Checking file i18n/zh                                      [ No update ]
  Checking file i18n/zh.utf8                                 [ No update ]
[ Rootkit Hunter version 1.3.8 ]
File updated: searched for 164 files, found 141
Warning: The SSH configuration option 'PermitRootLogin' has not been set.
         The default value may be 'yes', to allow root access.
Warning: Hidden directory found: /dev/.udev
Warning: Hidden file found: /etc/.logrotate.conf.swp: data
Warning: Hidden file found: /usr/bin/.ssh.hmac: ASCII text
Warning: Hidden file found: /usr/bin/.fipscheck.hmac: ASCII text
Warning: Hidden file found: /usr/sbin/.sshd.hmac: ASCII text

0 8,20 * * * /root/rkhunter.sh

Open in new window

0
 

Author Comment

by:sobeservices2
ID: 34951846
0 20 2 * *  /root/chkrootkit.sh | grep -v .packlist
0 20 2 * * /root/rkhunter.sh

Now I have this and its running over and over and over doesn't seem to stop
0
 
LVL 19

Expert Comment

by:simon3270
ID: 34952465
The ones above (in ID:34951846) should be fine - both will run the script at 8pm on the second of the month.

If you have
    * * * * * /root/rkhunter.sh
it will run every minute.
0
 
LVL 19

Expert Comment

by:simon3270
ID: 34952476
Have you left old rkhunter lines in your crontab?
0
 

Author Comment

by:sobeservices2
ID: 34952709
No left over lines in my crontab.

***** that explains it
Didn't know * meant every min

So you would say the best way would be commit it out if I don't want to use it right?

Thanks
0
 
LVL 19

Expert Comment

by:simon3270
ID: 34952858
Commenting out with # would be fine - I do that if I have an entry I don't want now, but may want again later.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question