Advertisement

Cron task from cmdline?

Started by October 02, 2002 03:21 AM
4 comments, last by Vasialek 22 years, 3 months ago
Hi, all! I would like to know if it is possible to add new task for crontab from command line? For example I could do: #echo ''0 15 * * * some_command_to_execute'' >> //var/spool/cron/crontabs/root But how it could be for simple, not super-user? Thanx, Lekha
There''s a crontab command. Use sudo to alter root''s crontab.
Advertisement
Yes, $crontab -e will put me in vi mode. Problem that I should put command from file to cron tasks. C++ programm will read & prepare cron style string, but how to put this string into cron?!
I have no ideas

Lekha
quote: Original post by Vasialek
Yes, $crontab -e will put me in vi mode. Problem that I should put command from file to cron tasks. C++ programm will read & prepare cron style string, but how to put this string into cron?!
I have no ideas


(crontab -l; echo ''0 15 * * * some_command_to_execute'') | crontab -
Oh, and following up to myself - on non-Debian systems that''ll add a copy of the "DO NOT EDIT THIS FILE" header every time it''s run. If you''re on a non-debian system, a "| tail +4" placed somewhere in that command line might be helpful.
Thanx, AP
But I should did: $crontab --help & I wouldn''t bother u Anyway your method is working perfect, so THANX a lot!!!

Lekha

This topic is closed to new replies.

Advertisement