Archived

This topic is now archived and is closed to further replies.

Vasialek

Cron task from cmdline?

Recommended Posts

Vasialek    130
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

Share this post


Link to post
Share on other sites
Vasialek    130
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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
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 -

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites