Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
Hello,
I need help please.
One of my script don't execute itself using crontab although it works manually.
=> /var/log/cron
/var/log/cron show these 2 lignes at sheduled time
May 26 09:59:01 COMPUTER crond[26439]: (root) CMD (/usr/local/bin/script)
May 26 09:59:01 COMPUTER crond[26438]: (root) MAIL (mailed 77 bytes of output but got status 0x0001 )
When i launch it manually the job is done and a third line appears :
May 26 10:15:01 COMPUTER crond[27784]: (root) CMD (LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok)
I am root and i use crontab -e to modify the crontab.
Root is the owner of the script and rights are ok
=> The script is :
#!/bin/bash
nas1=10.91.0.198:/mnt/NAS1
mnt1=/media/nas20091
if mount.nfs $nas1 $mnt1
then
rsync -rltDv --del --ignore-errors --force /home/ $mnt1/SLR/script/ > /var/log/nas/rapport_script_du_`date +\%d-\%m-\%y`.log
umount $mnt1
else
echo echec
fi
1. /usr/local/bin/savenas1lumeve: line 6: mount.nfs: command not found
echec
2. yes, i checked the result after this.
=> i don't understand the result (mount.nfs: command not found), do i need something more to launch it by crontab although it works when i launch the script directly ?
Last edited by simplycomplex; 05-26-2010 at 06:23 AM.
Reason: synthax
i don't understand the result (mount.nfs: command not found), do i need something more to launch it by crontab althought It works when i lauch the script directly ?
cron sets a limited $PATH. The workaround is either to set $PATH or give the full path for every command. If choosing the former, put something like this at the beginning of the script (you could check what $PATH is when yoou are logged on as root and adjust accordingly)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.