On 2013-05-29 02:16, pe1800 wrote:
>
> Thank you. I did a sudo crontab -e, added /home/pe1800/bin - for my
> script - to PATH, and 7 11 * * * root /home/pe1800/bin/avg.sh, saved
> the vi edit. Then did a sudo crontab -l and it showed my changes, again
> with a warning not to edit that file directly.
Please, the commands you post are not readable. Use code tags for
printouts and commands. Advanced editor, ‘#’ button.
Posting in
Code Tags - A Guide
Then, you are running a script in “/home/pe1800/bin/avg.sh” as root!
NEVER do that.
If root runs a script of him, he places it in “/root/bin/avg.sh”, never
in a directory under the control of a plain user (even if it is you).
If a user wants to run his own script, he edits his crontab, not
root’s crontab.
Lastly, emails sent to root are typically forwarded to the main user of
your system.
> I did a
> /var/spool/cron/tabs # cat root and everything is there. I also did an
> /etc cat crontab and, as you said, it hasn’t changed. That’s a mystery
> to me but, after your warning, I didn’t touch it. Will it, perhaps,
> change after rebooting?
No, it will not change.
> But what troubles me is when checking the mail it said I had - under MY
> userid - there was a message: /bin/sh: root: command not found.
> SHELL=/bin/sh was and still is the very first line in crontab, and I
> never touched it! How come?
The paragraph above is not clear to me. Please repost as it is in the
original, inside code tags. Like this:
cer@Telcontar:~> l /bin/sh
lrwxrwxrwx 1 root root 4 Aug 19 2012 /bin/sh -> bash*
cer@Telcontar:~>
/
The command and its output, complete, unchanged.
Now, a bit of an explanation. You can find this in the manuals in
complete detail.
There are several crontabs in the system.
You have the users crontabs, and root is another user. They are all
under the “/var/spool/cron/tabs/” directory.
You have the system main crontab, which is the file “/etc/crontab”. If
you need to change this one, you do that with an editor, directly.
You have the system crontab files, placed in the “/etc/cron.d/”
directory. The name is arbitrary, the syntax is a bit different, and
they are edited directly with an editor. Or, they are simply dropped
there by a package.
Lastly, in an openSUSE system, you also have the directories:
/etc/cron.hourly/
/etc/cron.weekly/
/etc/cron.monthly/
where you can place scripts that run once in the indicated period (you
do not control exactly when).
Other Linux system might use anacron instead.
–
Cheers / Saludos,
Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)