Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then 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.
ouch, nasty. Put the commands into a script, make sure that script works and then run the script from cron. For hourly jobs you should have a directory /etc/cron.hourly which you can just drop files in and they will then be executed hourly automatically.
Thanks. But why did you find the the small script on command line so "ouch, nasty"? Also what is difference between modifying cron using 'sudo crontab -e' and through /etc/crontab ?
I find running stuff in crontab can be confusing, and it's easy to be unclear where you are starting from. Your code is bash / sh but cron doesn't execute code within a shell, it's just directly run without a fully formed environment to utilize. So by saying "run this script with bash" as the cron instruction you can quickly get back to a common point that you can also get to from a normal login shell. Just much simpler that way.
as root, crontab -e will edit the root users crontab file in /var/spool/cron (or similar). this is different to the system crontab file in /etc/crontab. Personally I don't ever use roots crontab file, as it's so easy to forget about, and isn't anything root wants to do actually being done for the system as a whole, not him (or her) self?
I have replaced ~ with full pathname which is /home/home/ here.
I am not sure about "what crontab". I am using command 'sudo crontab -e' and modifying the commands. I am using ubuntu 10.04LTS. And I find the changes are incorporated in /var/spool/cron/crontabs/root file.
Ahh, I meant /etc/crontab vs crontab -e as the files are a different format. Does the script itself work if you manually execute the exact same cron command (including the bash bit) ?
The script itself works very well. I have not tried /etc/crontab but my problem is solved after I used the command 'crontab -e' (without sudo). Now it is working well. Earlier it must have been going to the root's crontab and I am not working as root most of the time.
@acid_kewpie: Thanks for your help. I realize that you have great experience in linux with almost 39000 posts here. I see that gentoo is your top distribution. How difficult is gentoo for an ubuntu user to migrate to. Is software installation and dependency resolution major problems there? If you want I will put this question as a separate thread.
it shoudl be a different thread really, but Gentoo is pretty easy really. I've not used it for a while, but the installation guide was always pretty simply, as long as you follow the right steps. It works differently low down to ubuntu, or any other distro I've used, but it's certainly worth a go.
Haha! I created the user home for my home computer, without realizing that all users are in /home directory in linux. So my home directory is /home/home. However, I have not had any problems with any programs, except one which refused to save data in 'home' directory!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.