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!
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
This last 4 lines are suppose to create 4 new files in the /backup folder and they are not working, the cron log is showing that the commands were run but when I browse to check the files created, the 4 backups are not there. The backup scripts work just fine when run from the command line. I need help to do this correctly. Thanks.
If the logs show the scripts being run, but no output is produced, the problem is probably inside the scripts themselves.
Do you use the full path to commands? For example, /usr/bin/tar instead of tar? cron runs with a different environment to a logged in user, paths and environment variables may not be what the script needs.
If you're referring to http://www.linuxquestions.org/questi...d.php?t=479234,
then your problem is different from the other one. Your cron jobs work just fine and just don't do what they're expected to. The other post is about cron not detecting any changes to the crontab settings, without restarting cron service.
As for your problem, start off by catching any output of your backup script into a file, by modifying the crontab command like this:
(/backup/backup_a 2>&1) > /tmp/backup_a.out
and likewise for the other ones.
If all goes well, you should get at least some clues of what's going wrong (ie error messages in /tmp/backup_a.out).
Most likely, they're related to issues with environment variables like $PATH, similar to the issue with tar.
I tried and then restarted cron to make sure it runs. I tried several times is like the cron weren't reading the file, It did not create any files nor in the backup folder or in tmp/ even thou the log says the script was executed. Any ideas what this could be? thank you again.
So the script executes but doesn't seem to do anything? Try putting a simple command like "date" or "whoami" at the top. If you then catch stdout in a file (ie in /tmp), you should see at least the output of that command, just to confirm that the script runs fine.
If it does run fine, then the lack of output may be simply due to the executed commands.
Thats my crontab, it executed the last command and created the file date.cron.out but it was empty, no data inside the file. I also tried it with the 2>&1 in that case no file was created at all. This is starting to piss me off cause I have no clue.
I don't really know cron that good, I fixed it using crontab -e and creating the crontab for root and putting the commands there instead of using the file /etc/crontab, for some reason now it works. Thanks anyways for all your help.