• Advertisement

Archived

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

Cron task from cmdline?

This topic is 5618 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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
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
Thanx, AP
But I should did: $crontab --help & I wouldn''t bother u Anyway your method is working perfect, so THANX a lot!!!

Lekha

Share this post


Link to post
Share on other sites

  • Advertisement