bbedit tool & crontab

105 views
Skip to first unread message

cp21yos

unread,
Nov 9, 2010, 6:35:07 AM11/9/10
to BBEdit Talk
Following the instructions I was at one time able to use 'crontab -e'
to edit my cron file.

Today after probably a year of not needing to edit my cron file I
tried to but the setup seems broken (I've checked my setup vs. the man
page for bbedit and all appears correct & unchanged).

BBedit opens but crontab throws out this message was the file is
saved...

craig:~: crontab -e
crontab: temp file must be edited in place

For ref:
craig:~: echo $EDITOR
bbeditsh
craig:~: more ~/Scripts/bbeditsh
#!/bin/sh
bbedit -w "$@"

craig:~: bbeditsh somefile.txt // this also works as expected

It's a minor problem but my inability to let broken things lie would
like to get to the bottom of this, at least fix or find out what I've
done or what's changed to break this once working process.

Cheers

Carlton Gibson

unread,
Nov 9, 2010, 8:54:37 AM11/9/10
to bbe...@googlegroups.com

On 9 Nov 2010, at 11:35, cp21yos wrote:

> Today after probably a year of not needing to edit my cron file I
> tried to but the setup seems broken


BBEdit changed in the meantime. You need to do this:

defaults write com.barebones.bbedit Filing:SafeSavesDisabled -bool YES

Regards,
Carlton

Doug McNutt

unread,
Nov 9, 2010, 12:47:46 PM11/9/10
to bbe...@googlegroups.com
At 03:35 -0800 11/9/10, cp21yos wrote:
>Following the instructions I was at one time able to use 'crontab -e'
>to edit my cron file.
>

try
crontab -l | bbedit
--

--> A fair tax is one that you pay but I don't <--

Nigel Stanger

unread,
Nov 9, 2010, 3:28:06 PM11/9/10
to bbe...@googlegroups.com
On 10/11/2010, at 2:54 AM, Carlton Gibson wrote:

> BBEdit changed in the meantime. You need to do this:
>
> defaults write com.barebones.bbedit Filing:SafeSavesDisabled -bool YES

Hmm, I'm not sure I like the idea of turning off safe saves globally just so I can edit my crontab in BBEdit. Wouldn't it make more sense to simply ignore that setting when you invoke bbedit -w?

--
Nigel Stanger, mailto:nsta...@infoscience.otago.ac.nz
Dept. of Information Science, http://divcom.otago.ac.nz/infosci/
University of Otago, Dunedin, NEW ZEALAND. XNS: =Nigel Stanger

"The last time somebody said, 'I find I can write much better with a word
processor,' I replied, 'They used to say the same thing about drugs.'"
--- Roy Blount, Jr.

Nigel Stanger

unread,
Nov 9, 2010, 3:49:05 PM11/9/10
to bbe...@googlegroups.com
On 10/11/2010, at 6:47 AM, Doug McNutt wrote:

> try
> crontab -l | bbedit

Unfortunately that doesn't really solve the original problem. Sure, it lets you edit the crontab, but you then have to figure out where to save it, which for user crontabs isn't at all obvious. So non-obvious, in fact, that I just discovered that Leopard moved them from where I remember them being (/var/cron/tabs) to somewhere completely different (/usr/lib/cron/tabs). Took me ten minutes to find the damn things :(.

--
Nigel Stanger, mailto:nsta...@infoscience.otago.ac.nz
Dept. of Information Science, http://divcom.otago.ac.nz/infosci/
University of Otago, Dunedin, NEW ZEALAND. XNS: =Nigel Stanger

"A computer lets you make more mistakes faster than any invention in human
history --- with the possible exceptions of handguns and tequila."
--- Mitch Ratliffe

Doug McNutt

unread,
Nov 9, 2010, 6:51:56 PM11/9/10
to bbe...@googlegroups.com
At 09:49 +1300 11/10/10, Nigel Stanger wrote:
>On 10/11/2010, at 6:47 AM, Doug McNutt wrote:
>
>> try
>> crontab -l | bbedit
>
>Unfortunately that doesn't really solve the original problem. Sure, it lets you edit the crontab, but you then have to figure out where to save it, which for user crontabs isn't at all obvious. So non-obvious, in fact, that I just discovered that Leopard moved them from where I remember them being (/var/cron/tabs) to somewhere completely different (/usr/lib/cron/tabs). Took me ten minutes to find the damn things :(.

Actually I always save such things where they get backed up. That way I can do things like saving an original so that I can easily step backward after I mess something up.

The crontab tool will accept a file name as an argument to change the whole table If the file name is a single - it reads standard input. I thought that crontab processed the table so that the actual requests were merged into a global table for all users somewhere, perhaps in /var. But the format may not be what you expect.

I haven't tried it but crontab might be happy with a new table piped to it and you might also be able to redirect the clipboard to it.

After doing the crontab -l | bbedit, select the edited table and edit_copy, then

pbpaste | crontab -

crontab < pbpaste

crontab - < pbpaste

cat pbpaste | crontab -

One of them might work. But be sure to back up your original table.

man crontab does say that the EDITOR must save in place. BBedit might not want to do that, preferring to execute a save to a new file and delete the old only after being satisfied that the save operation worked OK.

--
--> Marriage and kilo are troubled words. Turmoil results when centuries-old usage is altered in specialized jargon <--.

TJ Luoma

unread,
Nov 9, 2010, 6:17:34 PM11/9/10
to bbe...@googlegroups.com
On Tue, Nov 9, 2010 at 3:49 PM, Nigel Stanger
<nsta...@infoscience.otago.ac.nz> wrote:
> Unfortunately that doesn't really solve the original problem. Sure, it lets you edit the crontab, but you then have to figure out where to save it, which for user crontabs isn't at all obvious. So non-obvious, in fact, that I just discovered that Leopard moved them from where I remember them being (/var/cron/tabs) to somewhere completely different (/usr/lib/cron/tabs). Took me ten minutes to find the damn things :(.
>

I save my user crontab as ~/.crontab, and then do

crontab ~/.crontab

when I'm done editing it.

TjL

Alex Satrapa

unread,
Nov 9, 2010, 7:21:02 PM11/9/10
to bbe...@googlegroups.com
On 10/11/2010, at 10:17 , TJ Luoma wrote:

I save my user crontab as ~/.crontab, and then do

crontab ~/.crontab

when I'm done editing it.

I do something similar - bunch of files such as my crontab are in a git repository, I edit them in my own good time, then install them using the appropriate tools (such as, for example, Puppet or Capistrano).

Editing crontabs in-place is *so* last century… ;)

Alex Satrapa | web.mac.com/alexsatrapa | Ph: +61 4 0770 5332


Carlton Gibson

unread,
Nov 10, 2010, 4:49:39 AM11/10/10
to bbe...@googlegroups.com

On 9 Nov 2010, at 20:28, Nigel Stanger wrote:

> Hmm, I'm not sure I like the idea of turning off safe saves globally just so I can edit my crontab in BBEdit.

Yes, I feel that. Two points though:

1. Safe saves itself is quite new and you probably never missed it before.
2. I asked Patrick and he said it was okay.

;-)

Reply all
Reply to author
Forward
0 new messages