crontab not working as expected on SuSE linux

I have always set a cronjob as follows(say on RedHat):

crontab -e

and then type in the command in there like:

0,30 * * * *       root    /path/to/cron_script >/dev/null

I am doing exactly the same in SuSE linux....but it simply won't work!!

I then tried to write the same command in a file under /etc/cron.d/ (yast2-online-update is also under this directory). It still doesn't work!!!

What am I doing wrong???!!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You should be using:

0,30 * * * *  /path/to/cron_script > /dev/null

The extra "root" in there is probably screwing things up.  If this crontab entry is for "root" then it will be run as "root".

Looking at my comment I should have been clearer.

If you want to run this as "root", then put it root's crontab.  You can get the specifics of the crontab format by typing:

man 5 crontab

sandeep_thAuthor Commented:
Doesn't says in the SuSE Linux admin manual that(quoted verbatim):

/etc/crontab cannot be processed with crontab -e . It must be loaded directly into an editor, modified, then saved.

On opening /etc/crontab I found the following lines:

# check scripts in cron.hourly, cron.daily, cron.weekly, and cron.monthly
-*/15 * * * *   root  test -x /usr/lib/cron/run-crons && /usr/lib/cron/run-crons >/dev/null 2>&1
59 *  * * *     root  rm -f /var/spool/cron/lastrun/cron.hourly
14 4  * * *     root  rm -f /var/spool/cron/lastrun/cron.daily
29 4  * * 6     root  rm -f /var/spool/cron/lastrun/cron.weekly
44 4  1 * *     root  rm -f /var/spool/cron/lastrun/cron.monthly

So I added one of my own at the end:

* * * * *       root  rm -f /path/to/doodle

which should simply remove the file /path/to/doodle ...every minute.

It simply doesn't do it!!
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

Ahhh... there is the system crontab (which is in /etc), and there is a per-user crontab.  I hadn't thought about the one in /etc because I never modify that.  Sorry about that...

Did you restart the cron daemon after you changed the file?

/etc/init.d/cron restart


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
I know that you aren't supposed to have to restart cron when you make a change to this but I was more interested so as to ensure that you have cron started!

Assuming that cron is running,  /pat/to/doodle is not marked immutable, is it?   Just for fun you can do something like this:

* * * * * root echo date >> /tmp/testdrive

and you should see a line added once per minute to the file.

sandeep_thAuthor Commented:
That was it....i had to restart the cron daemon with :
/etc/init.d/cron restart

and it worked!!

editing crontab -e wouldn't require u to restart it...I wonder why they changed it!!

Also....just for do u mean "marked immutable"?
The file can't be changed by anyone.  It's a safeguard against accidental (or malicious) change.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.