Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
It is possible, so long as it is possible to access a mail server directly. I have done it, by hand, using telnet, so it can be done. Certainly it should therefor be possible to code the process. Issues will come in if the mail server in question uses some of the new encryption and security features, because those cannot easily be coded or scripted.
Possible does not mean smart. The smarter option is to install and configure a minimal MTA set up to use your mail server as a SMARTHOST. MSMTP and EXIM are reasonable options, but there are others. That way proper logging and handling outbound email is easier and you can use standard tools instead of reinventing the horse.
cron requires that each entry in a crontab end in a newline character. If the last entry in a crontab is missing a newline (i.e. terminated by EOF), cron will consider the crontab (at least partially) broken. A warning will be written to syslog.
2) Try sun or 0 instead of Sun. It shouldn't matter, but there're different implementations of cron: Vixie cron, cronie, etc. POSIX only mandates numbers as days of week.
The last line did end with a carriage return, so that wasn't it.
I should have checked /var/log/sys
Code:
Nov 8 12:25:01 debian CRON[2845]: (root) CMD (/root/show.free.disk.space.bash)
Nov 8 12:25:01 debian cron[2852]: sendmail: 550 5.7.1 <root@isp.com>: Sender address rejected: you are not root@isp.com
Nov 8 12:25:01 debian sSMTP[2852]: 550 5.7.1 <root@isp.com>: Sender address rejected: you are not root@isp.com
Nov 8 12:25:01 debian CRON[2844]: (root) MAIL (mailed 66 bytes of output but got status 0x0001 from MTA#012)
cron[266]: sendmail: 550 5.7.1 <root@isp.com>: Sender address rejected: you are not root@isp.com
sSMTP[24771]: 550 5.7.1 <root@isp.com>: Sender address rejected: you are not root@isp.com
CRON[24759]: (root) MAIL (mailed 61 bytes of output but got status 0x0001 from MTA#012)
Since ssmtp is deadware since 2013, I'll experiment with msmtp.
It doesn't work either: For some reason, ssmtp is invisible to a non-root user:
Code:
fred@debian:~$ ./test.bash: line 9: ssmtp: command not found
fred@debian:~$ which ssmtp
fred@debian:~$
Besides, I get the same error in syslog even after creating /etc/cron.d/cron.allow to include root + fred, and adding a job as "fred":
Code:
CRON[25475]: (fred) CMD (test.bash)
cron[266]: sendmail: 550 5.7.1 <root@isp.com>: Sender address rejected: you are not root@isp.com
sSMTP[25476]: 550 5.7.1 <root@isp.com>: Sender address rejected: you are not root@isp.com
Have you considered modifying the script to use sudo or doas for the parts that need to run as root, but having it scheduled, run, and send mail under your personal account?
This presumes that your personal account has no problem sending email.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.