From: Francis Hwang Date: 2004-11-12T03:03:17+09:00 Subject: Re: Writing a looping, low-configuration script in Ruby Cool! Funny that stuff isn't in the man page. Thanks much. On Nov 11, 2004, at 9:09 AM, Florian Frank wrote: > On 2004-11-11 22:44:51 +0900, Francis Hwang wrote: >> So then I was thinking: Can I have a config that automatically edits >> the crontab? Has anybody used Ruby to programmatically edit a crontab? >> I suppose the brute force way to do it is to call "crontab -e" and >> send the various keystrokes to stdin, but I wonder if anybody knows of >> a less duct-tapey way. > > You can install a new crontab with > $ crontab filename > or > $ crontab - > for stdin input. > > You can output the current crontab of $USER with > $ crontab -l > filename > > Of course you can do this in a ruby script, too. In this case you > should > perhaps use a lock file. > > If you only want to run a script every 30 minutes with cron, you > can add a line like > */30 * * * * /path/to/script.rb > to your crontab. This is actually one of the main reasons to install > something like cron. > > -- > Florian Frank >