Hot answers tagged cron
5
First, you need to use full path like:
0 0 * * * /path/to/mysql_backup.sh
Second, you need to make sure your script has execute permission or you can invoke it using:
0 0 * * * /bin/bash /path/to/mysql_backup.sh
Third, you need to make sure you are executing your cron job with enough privilege.
3
Look in the log that contains your cron messages (/var/log/{cron,syslog} or elsewhee) and see which user is running the jobs and ensure that it's the user you expect.
Failing that it's possible you added them to /etc/crontab or one of the fragments in /etc/cron.d or even put a script in /etc/cron.{daily,hourly,monthly,weekly}.
If it's in a user cron tab ...
2
Generally, cron jobs that do things like "backup files" and "send email" need to do so within the context of the user whose files they are manipulating. This ensures that they have permission to read and write the files, and that actions taken can be audited as corresponding to that user.
So you will want to run the cron jobs as the user on whose behalf ...
2
As your parameter to find is -mtime which translates to "File's data was last modified n*24 hours ago" according to the documentation for find, it would be the date the file has been uploaded to (or modified on) your FTP server.
To determine a suitable value for +t take a look at the following section about how find rounds the time for matching:
When ...
2
I won't pretend to have attempted this particular task myself, but this Stack Overflow question has some answers that show potential command line trickery:
http://stackoverflow.com/questions/350047/how-to-instruct-cron-to-execute-a-job-every-second-week
1
What you can do is to remove that MAILTO and then just use a root forwarder.
/root/.forward <- just place your email in there, nothing else. Assuming you are running the cron job as root. You can also do it via /etc/aliases, add the line: user: my@email.com
1
You could pipe the script to ts from moreutils, which will prepend the timestamp to each line, like for example:
(cd /home/username/public_html/domain.tld/production && /usr/local/bin/php /home/username/public_html/domain.tld/production/cron.php) | ts >>/home/username/public_html/domain.tld/production/var/log/crontab_output.log 2>&1
...
1
That depends on the type of cronjon.
Example 1:
wget http://domain.com/cron.php
In this case doesn't matter the running user.
Example 2:
/usr/bin/php /var/www/domain.com/cron.php
In this case i would run with the same user the virtualhost is running (in case each vhost has own user). Because the script might create files/folder or attempt to write ...
1
If you did not install Webmin or use it, I would be very concerned by this message.
Webmin provides a lot of access to change system settings, it is also known to have a large number of security flaws that could allow malicious users to break into your server.
If you are not actively using Webmin you should either remove it, stop it, or firewall it to ...
Only top voted, non community-wiki answers of a minimum length are eligible
