Hi all,
I have a problem in using cron utility.
Here's the steps I followed as root user:
# crontab -u root /etc/crontab
# crontab -e
then I edited the crontab as follows:
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# run-parts
1-59 * * * * root run-parts /usr/bin/w >> /ws.log
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
as shown this should write output of w command into /ws.log file.
I waited for a minute then I got email with the following output:
From root@localhost.localdomain Thu Jan 26 18:46:02 2006
Date: Thu, 26 Jan 2006 18:46:01 +0400
From: root@localhost.localdomain (Cron Daemon)
To: root@localhost.localdomain
Subject: Cron <root@pc2> root run-parts /usr/bin/w >> /ws.log
X-Cron-Env: <SHELL=/bin/bash>
X-Cron-Env: <PATH=/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <MAILTO=root>
X-Cron-Env: <HOME=/>
X-Cron-Env: <LOGNAME=root>
X-Cron-Env: <USER=root>
/bin/bash: root: command not found
Obviously the command didn't work.
I also re-edited the crontab as follows:
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# run-parts
1-59 * * * * /usr/bin/w >> /ws.log
still I had the same problem.
Any help will be appreciated.