Hello forum,
I'll break down my problem into sort of a Q&A style monologue, so please bear with me.
Q: What am I trying to do?
A: I want to set up duply to run every hour. (http://www.freshports.org/sysutils/duply/)
Q: What is the problem?
A: When running duply from shell as root, everything seems working just fine. But as soon as I try to automate this by using cron, nothing happens.
Q: Do you get any error messages? What does the log say?
A: Thanks, now I've got "What does the log say?" stuck in my brain. Anyway, I'm receiving an error message claiming that bash is not in the path of root. (Or so I understand.) Error message:
Q: Are you sure that you set the path correctly?
A: I'm trying my hands on this for pretty much the first time. So I'll guess the answer is no. This is what I'm getting when I run
This is what I'm getting when I set a cronjob to run
Q: Please examine the username stated in the respective
A: No, but I've got no idea why. But does it matter, since I configured the cronjob to be run as root by editing the crontab using this command:
Thank you for your patience,
-frozen
05-01-2013 15:00 UPDATE
I tried setting the PATH variable at the top of the script just to see if this would help - it did not.
05-01-2013 15:24 UPDATE
I added the cronjob line to /etc/crontab and ran
To clarify here is what I cut from
I added the username and put it into /etc/crontab:
Is there any downside to this, besides the fact that this cronjob won't show up as conveniently when using
05-01-2013 15:58 UPDATE / SOLVED
Dear helpful people on the internet, Today I learned that the magic of cron, specifically the environment variables, can be set either by editing /etc/crontab or simply declaring them in the user specific crontab using
Your faithful student,
Neck-beard Sparkle
I'll break down my problem into sort of a Q&A style monologue, so please bear with me.
Q: What am I trying to do?
A: I want to set up duply to run every hour. (http://www.freshports.org/sysutils/duply/)
Q: What is the problem?
A: When running duply from shell as root, everything seems working just fine. But as soon as I try to automate this by using cron, nothing happens.
Q: Do you get any error messages? What does the log say?
A: Thanks, now I've got "What does the log say?" stuck in my brain. Anyway, I'm receiving an error message claiming that bash is not in the path of root. (Or so I understand.) Error message:
Code:
Subject: Cron Daemon
Cron <root@hostname> /usr/local/bin/duply hailmarrybackup
env: bash: No such file or directory
Q: Are you sure that you set the path correctly?
A: I'm trying my hands on this for pretty much the first time. So I'll guess the answer is no. This is what I'm getting when I run
env | grep -e PATH
from my shell.
Code:
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/root/bin
env | grep -e PATH > /tmp/cronpath.log
.
Code:
PATH=/usr/bin:/bin
Q: Please examine the username stated in the respective
env
output. Do they match?A: No, but I've got no idea why. But does it matter, since I configured the cronjob to be run as root by editing the crontab using this command:
Code:
crontab -e -u root
Thank you for your patience,
-frozen
05-01-2013 15:00 UPDATE
I tried setting the PATH variable at the top of the script just to see if this would help - it did not.
05-01-2013 15:24 UPDATE
I added the cronjob line to /etc/crontab and ran
service cron restart
. IT WORKS.To clarify here is what I cut from
crontab -e -u root
:
Code:
25 * * * * /usr/local/bin/duply vollbackup backup_verify_purge --force
I added the username and put it into /etc/crontab:
Code:
25 * * * * root /usr/local/bin/duply vollbackup backup_verify_purge --force
crontab -e
?05-01-2013 15:58 UPDATE / SOLVED
Dear helpful people on the internet, Today I learned that the magic of cron, specifically the environment variables, can be set either by editing /etc/crontab or simply declaring them in the user specific crontab using
crontab -e -u root
. This was a valuable lesson!Your faithful student,
Neck-beard Sparkle