-   SUSE / openSUSE (
-   -   cron tab (

thefedexguy 07-06-2006 09:21 AM

cron tab
Trying to add this to my root's cron but it does not work.
All i get is this bash: syntax error near unexpected token `('
Any help would be great

If you want to get the output of chkrootkit once a day per email at 3 am you can put the following line in root's cron file (the location depends on your distribution; under Debian it is under /var/spool/cron/crontabs/root; you might also find it under /var/spool/cron/tabs/root or something similar):

0 3 * * * (cd /usr/local/chkrootkit; ./chkrootkit 2>&1 | mail -s "chkrootkit output" me@myself.tld)

bash: syntax error near unexpected token `('

b0uncer 07-06-2006 09:28 AM

First of all, I don't think you should edit the file straight away; use crontab -e instead, as root. Second, why are there "(" and ")"? I suppose you don't need them. To me it looks like that should work without them..

thefedexguy 07-06-2006 09:37 AM

I have no clue, i just want to run it once a day and email me the output of the command chkrootkit

b0uncer 07-06-2006 09:40 AM


0 3 * * * cd /usr/local/chkrootkit; ./chkrootkit 2>&1 | mail -s "chkrootkit output" me@myself.tld
That does the job I'm quite sure. I have no clue where you got the "()" around it..

EDIT: unless the writer of the "help" text wanted you to notice that the whole thing inside "(" and ")" was the cron job to be run, so you wouldn't be confused about the semicolons or anything..well sounds stupid but that's all I can think of.

Just run crontab -e as root and write the above (quoted) line there, save and that's it. If you use VI as you probably do, then after running "crontab -e" you get the file open, press down-arrow until you're at the last line, then press shift-a to go to Append mode, press ENTER to start a new line and write the above (quoted) line there. If the file is empty, just press shift-a and start typing. When you've written it, press ESC button once (or twice if you're unsure, you should hear a beep) and type :wq and press ENTER to save and exit. You're done.

thefedexguy 07-06-2006 11:03 AM

Thanks for the help b0uncer! One more question.:scratch:
will i need change the permissions on that crontab -e? chmod 600?

I'm very new to this cron stuff. I'm just lost with this crontab root, crontab -e, and cron.daily

All times are GMT -5. The time now is 10:34 PM.