cron on 10.5.2 server
|
|
Thread rating:  |
Robert Peirce - 21 Apr 2008 12:49 GMT I still don¹t know how to create a crontab in the standard way. Crontab e produces the following output: $ crontab e create entry ZZ to exit crontab: no crontab for rbp - using an empty one crontab: temp file must be edited in place
However, it works properly on my wife's 10.5.2 client and my 10.4.11 client. Something seems not to be set correctly.
I have found a work-around. 1. Create a file of cron commands, cronfile. 2. crontab cronfile Any time you want to update your crontab, you need to edit the local file and use step 2 again. This works. BTW, once an actual crontab is created, the crontab e sequence only produces the second line of the error message. Although I can now function, I would still like to know why this doesn't work. The man page doesn't even mention these errors and I am totally at sea on this.
Oh, BTW, while cron works on 10.5.2 server, each command that runs leaves an error message in /var/log/system.log, so although it is working, it isn't working quite right. This has been mentioned by others so it is not unique to my installation.
 Signature Robert B. Peirce, Venetia, PA 724-941-6883 bob AT peirce-family.com [Mac] rbp AT cooksonpeirce.com [Office]
André Berger - 21 Apr 2008 20:45 GMT * Robert Peirce (2008-04-21):
> I still don¹t know how to create a crontab in the standard way. Crontab > e produces the following output: [quoted text clipped - 12 lines] > 1. Create a file of cron commands, cronfile. > 2. crontab cronfile I had to do a
sudo ln -s /usr/lib/cron /var/
and use
EDITOR=nano crontab -e
b/c I'm too lazy to figure out the correct vim options on Leopard/client
-André
 Signature May as well be hung for a sheep as a lamb! Linkstation/KuroBox/HG/HS/Tera Kernel 2.6/PPC from <http://hvkls.dyndns.org>
Robert Peirce - 22 Apr 2008 01:13 GMT > * Robert Peirce (2008-04-21): > > I still don¹t know how to create a crontab in the standard way. Crontab [quoted text clipped - 24 lines] > b/c I'm too lazy to figure out the correct vim options on > Leopard/client The problem is not with client. That works fine and as expected. The problem is with server.
I can edit the file alright. It just doesn't get saved in the correct location. /var/cron is not the solution, nor is the specific editor I use.
 Signature Robert B. Peirce, Venetia, PA 724-941-6883 bob AT peirce-family.com [Mac] rbp AT cooksonpeirce.com [Office]
Bob Harris - 22 Apr 2008 01:02 GMT > I still don¹t know how to create a crontab in the standard way. Crontab > e produces the following output: [quoted text clipped - 7 lines] > However, it works properly on my wife's 10.5.2 client and my 10.4.11 > client. Something seems not to be set correctly. I experienced the same problem, and it was because I was using my own install of Vim <http://www.vim.com>.
I solved my problem by defining a bash shell alias that makes sure I'm using the Mac OS X provided vi (really Vim, but as provided by Apple):
alias crontab='EDITOR=/usr/bin/vi /usr/bin/crontab'
This works every time, all the time.
Bob Harris
André Berger - 22 Apr 2008 06:04 GMT * Bob Harris (2008-04-22):
> > I still don¹t know how to create a crontab in the standard way. Crontab > > e produces the following output: [quoted text clipped - 16 lines] > > alias crontab='EDITOR=/usr/bin/vi /usr/bin/crontab' I think one would have to ":set noswap" in vim
-André
 Signature May as well be hung for a sheep as a lamb! Linkstation/KuroBox/HG/HS/Tera Kernel 2.6/PPC from <http://hvkls.dyndns.org>
Robert Peirce - 22 Apr 2008 14:33 GMT > * Bob Harris (2008-04-22): > > [quoted text clipped - 20 lines] > > I think one would have to ":set noswap" in vim That is an "unknown option" in vi.
 Signature Robert B. Peirce, Venetia, PA 724-941-6883 bob AT peirce-family.com [Mac] rbp AT cooksonpeirce.com [Office]
André Berger - 23 Apr 2008 05:45 GMT * Robert Peirce (2008-04-22):
> > * Bob Harris (2008-04-22): [...]
> > > > crontab: temp file must be edited in place [...]
> > > I solved my problem by defining a bash shell alias that makes sure > > > I'm using the Mac OS X provided vi (really Vim, but as provided by [quoted text clipped - 5 lines] > > That is an "unknown option" in vi. That's why I wrote "vim" :)
-André
 Signature May as well be hung for a sheep as a lamb! Linkstation/KuroBox/HG/HS/Tera Kernel 2.6/PPC from <http://hvkls.dyndns.org>
Dave Seaman - 23 Apr 2008 13:09 GMT > * Robert Peirce (2008-04-22): >> [quoted text clipped - 11 lines] >> >> That is an "unknown option" in vi.
> That's why I wrote "vim" :) It's an "unknown option" in /usr/bin/vim, at least under OS X 10.5.2 client.
 Signature Dave Seaman Third Circuit ignores precedent in Mumia Abu-Jamal ruling. <http://www.indybay.org/newsitems/2008/03/29/18489281.php>
André Berger - 23 Apr 2008 16:31 GMT * Dave Seaman (2008-04-23):
> > * Robert Peirce (2008-04-22): > >> [quoted text clipped - 16 lines] > It's an "unknown option" in /usr/bin/vim, at least under OS X 10.5.2 > client. Ouch, it's ":set noswapfile", sorry!
-André
 Signature May as well be hung for a sheep as a lamb! Linkstation/KuroBox/HG/HS/Tera Kernel 2.6/PPC from <http://hvkls.dyndns.org>
Lewis - 02 May 2008 14:09 GMT >> I think one would have to ":set noswap" in vim
> That is an "unknown option" in vi. And that has wheat to do with setting it in *vim*??
Nothing?
Right.
 Signature I got a question. If you guys know so much about women, how come you're here at like the Gas 'n' Sip on a Saturday night completely alone drinking beers with no women anywhere?
Robert Peirce - 22 Apr 2008 14:32 GMT > > I still don¹t know how to create a crontab in the standard way. Crontab > > e produces the following output: [quoted text clipped - 20 lines] > > Bob Harris I just tried that and got the same
crontab: temp file must be edited in place
error. Something else is gong on here.
 Signature Robert B. Peirce, Venetia, PA 724-941-6883 bob AT peirce-family.com [Mac] rbp AT cooksonpeirce.com [Office]
Bob Harris - 23 Apr 2008 00:55 GMT > > > I still don¹t know how to create a crontab in the standard way. Crontab > > > e produces the following output: [quoted text clipped - 26 lines] > > error. Something else is gong on here. When you are editing in vi/Vim, do you have a habit of doing
:w
I have that habit, and I've found that if I do that while editing crontab files, it screws up crontab and I get a similar message to what you are seeing.
I think the primary problem is if the editor creates a new file (even if it has the same name) with a different file system inode number, then crontab gets upset.
There are modes in Vim that can use the original as a backup file and write an updated new file with the old name, or write the updated information to a new file and when that is safely on disk, do renames. I think it is this behavior that upsets crontab.
So maybe you need to comb through your .vimrc (or .exrc) to see if there is any option causing this.
If you do have a .vimrc option to cause new files to be created, try disabling it. If that works, but you like the option, then create a script to invoke Vim with the -u NONE option, and invoke this crontab with "EDITOR=your_script crontab -e"
Bob Harris
Robert Peirce - 23 Apr 2008 12:28 GMT > > > > I still don¹t know how to create a crontab in the standard way. > > > > Crontab [quoted text clipped - 22 lines] > > :w I don't think that is the issue. Crontab -e used to work before we re-installed the OS. Something got changed, but I don't know what.
 Signature Robert B. Peirce, Venetia, PA 724-941-6883 bob AT peirce-family.com [Mac] rbp AT cooksonpeirce.com [Office]
Jolly Roger - 23 Apr 2008 14:45 GMT > Crontab -e used to work before we > re-installed the OS. Something got changed, but I don't know what. It may be you have a corrupt / incomplete install.
Did you upgrade, by chance?
 Signature Please send all responses to the relevant news group. E-mail sent to this address may be devoured by my very hungry SPAM filter. I do not read posts from Google Groups. Use a real news reader if you want me to see your posts.
JR
Robert Peirce - 23 Apr 2008 15:46 GMT > > Crontab -e used to work before we > > re-installed the OS. Something got changed, but I don't know what. > > It may be you have a corrupt / incomplete install. > > Did you upgrade, by chance? Our consultant was messing with the system and got it to a state where we had to restore from a SuperDuper backup. I agree something seems to be corrupt, but I can't figure out what. Unfortunately, I have no idea how to interpret the error message. What does it mean that the file must be edited in place?
 Signature Robert B. Peirce, Venetia, PA 724-941-6883 bob AT peirce-family.com [Mac] rbp AT cooksonpeirce.com [Office]
Chris Ridd - 23 Apr 2008 16:12 GMT >>> Crontab -e used to work before we >>> re-installed the OS. Something got changed, but I don't know what. [quoted text clipped - 6 lines] > we had to restore from a SuperDuper backup. I agree something seems to > be corrupt, but I can't figure out what. Unfortunately, I have no idea I think you have to tell the consultant to fix what he's broken. There's a reason you're paying them mega bucks, eh?
> how to interpret the error message. What does it mean that the file > must be edited in place? Basically, are the contents of the existing file changing (edited in place) or is a new file being created and given the old file's name.
In pseudo-code, is this happening:
open existing file for read/write read everything overwrite with different stuff close file
or this:
open existing file for read read everything close file open new file for write write different stuff close new file delete existing file rename new file as existing file
Cheers,
Chris
Robert Peirce - 24 Apr 2008 13:42 GMT > I think you have to tell the consultant to fix what he's broken. > There's a reason you're paying them mega bucks, eh? I agree, but it won't work. It turns out these consultants are specialists in OS X. I think I know more about the underlying Unix system than they do and it should be clear from my posts that I don't know as much as I should!
The people who are taking over from me as I move into retirement know even less than I do, which is why we are hiring more consultants.
Anyhow, if this problem is going to get solved I have to do it.
 Signature Robert B. Peirce, Venetia, PA 724-941-6883 bob AT peirce-family.com [Mac] rbp AT cooksonpeirce.com [Office]
Jolly Roger - 24 Apr 2008 16:05 GMT > > I think you have to tell the consultant to fix what he's broken. > > There's a reason you're paying them mega bucks, eh? [quoted text clipped - 3 lines] > system than they do and it should be clear from my posts that I don't > know as much as I should! If the consultants are specialists in Mac OS X, and they can't fix what they've broken, and you know more than them, why are you hiring them?!
> The people who are taking over from me as I move into retirement know > even less than I do, which is why we are hiring more consultants. > > Anyhow, if this problem is going to get solved I have to do it. The problem is if cron is screwed up, other things may be screwed up as well. Personally, I wonder if your install did not complete correctly. The only good way to solve that problem is to re-install the operating system.
 Signature Please send all responses to the relevant news group. E-mail sent to this address may be devoured by my very hungry SPAM filter. I do not read posts from Google Groups. Use a real news reader if you want me to see your posts.
JR
Robert Peirce - 24 Apr 2008 16:24 GMT > > I agree, but it won't work. It turns out these consultants are > > specialists in OS X. I think I know more about the underlying Unix [quoted text clipped - 3 lines] > If the consultants are specialists in Mac OS X, and they can't fix what > they've broken, and you know more than them, why are you hiring them?! This is Unix problem. I know more than they do about Unix, not about OS X. I got into OS X because it reminded me of NEXTSTEP, which I had used before. However, I have never tried to become an expert in it. In fact, I am probably only aware of 25% of what it can do. We needed OS X specialists to help us move to a 100% Apple network over the next few years. I don't have the knowledge to do that and it may not be completed before I leave.
> The problem is if cron is screwed up, other things may be screwed up as > well. Personally, I wonder if your install did not complete correctly. > The only good way to solve that problem is to re-install the operating > system. I hate to do that but you are probably correct. So far we have only found the one problem, but there could be more. Actually, cron works fine. It is crontab -e that is acting up, and I guess that means it is vim that is acting up.
 Signature Robert B. Peirce, Venetia, PA 724-941-6883 bob AT peirce-family.com [Mac] rbp AT cooksonpeirce.com [Office]
Jolly Roger - 24 Apr 2008 16:36 GMT > > > I agree, but it won't work. It turns out these consultants are > > > specialists in OS X. I think I know more about the underlying Unix [quoted text clipped - 11 lines] > years. I don't have the knowledge to do that and it may not be > completed before I leave. Mac OS X is a Unix-based operating system. What, exactly, are these consultants qualifications, if they know nothing of Unix?
I am considered by my employers to be a Mac OS X / Linux / Unix specialist. I'd have a hard time believing anyone who calls himself a Mac OS X specialist without knowing anything about the underlying system that makes Mac OS X what it is.
> > The problem is if cron is screwed up, other things may be screwed up as > > well. Personally, I wonder if your install did not complete correctly. [quoted text clipped - 5 lines] > fine. It is crontab -e that is acting up, and I guess that means it is > vim that is acting up. It's obvious whatever the consultant did, and however you recovered from the backup, left you with a system that is not in a good state.
Again, if it were me, and especially if this were a mission-critical server, I'd reinstall from scratch (meaning erase and install) so that I was sure the install went flawlessly.
And I'd be careful to whom I gave administrator access in the future! Perhaps these consultants can get their jobs done with non-administrator accounts. That way if they do screw something up, they only screw up their own user accounts.
 Signature Please send all responses to the relevant news group. E-mail sent to this address may be devoured by my very hungry SPAM filter. I do not read posts from Google Groups. Use a real news reader if you want me to see your posts.
JR
Chris Ridd - 24 Apr 2008 16:50 GMT > I hate to do that but you are probably correct. So far we have only > found the one problem, but there could be more. Actually, cron works > fine. It is crontab -e that is acting up, and I guess that means it is > vim that is acting up. I'm shocked that no-one's suggested using emacs yet ;-)
If you set make-backup-files to nil, I think emacs will do what's needed.
Actually, TextWrangler will probably work as well if you insist on having a GUI.
Cheers,
Chris
Jolly Roger - 24 Apr 2008 17:40 GMT > > I hate to do that but you are probably correct. So far we have only > > found the one problem, but there could be more. Actually, cron works > > fine. It is crontab -e that is acting up, and I guess that means it is > > vim that is acting up. > > I'm shocked that no-one's suggested using emacs yet ;-) Why? emacs isn't available on all ditributions and installations of *nix. In comparison, vi/vim is almost always there, and it's the default editor in many, many installations.
> If you set make-backup-files to nil, I think emacs will do what's needed. > > Actually, TextWrangler will probably work as well if you insist on > having a GUI. The editor isn't his problem.
 Signature Please send all responses to the relevant news group. E-mail sent to this address may be devoured by my very hungry SPAM filter. I do not read posts from Google Groups. Use a real news reader if you want me to see your posts.
JR
Chris Ridd - 24 Apr 2008 18:04 GMT >>> I hate to do that but you are probably correct. So far we have only >>> found the one problem, but there could be more. Actually, cron works [quoted text clipped - 6 lines] > *nix. In comparison, vi/vim is almost always there, and it's the default > editor in many, many installations. Who cares about other Unixes, we're talking about OS X.
Cheers,
Chris
Jolly Roger - 24 Apr 2008 22:06 GMT > >>> I hate to do that but you are probably correct. So far we have only > >>> found the one problem, but there could be more. Actually, cron works [quoted text clipped - 8 lines] > > Who cares about other Unixes, we're talking about OS X. We're talking about using crontab to edit cron tables, and vi/vim has beeen the default editor for crontab for, like forever.
 Signature Please send all responses to the relevant news group. E-mail sent to this address may be devoured by my very hungry SPAM filter. I do not read posts from Google Groups. Use a real news reader if you want me to see your posts.
JR
Chris Ridd - 25 Apr 2008 07:04 GMT > We're talking about using crontab to edit cron tables, and vi/vim has > beeen the default editor for crontab for, like forever. Sure but $EDITOR's been around for probably nearly as long. There's nothing which says you need to use vi.
Cheers,
Chris
Lewis - 02 May 2008 14:19 GMT > We're talking about using crontab to edit cron tables, and vi/vim has > beeen the default editor for crontab for, like forever. Except when it's not.
crontab actually has no default editor, it simply uses the EDITOR defined in your environment settings.
crontab is a little retarded with the whole swapfile issue, and that can be an issue in any EDITOR that does the 'right thing' and has you work and edit a swapfile instead of the original. Most other utilities (visudo, for example) do not have this retarded behavior.
And yeah, I now it's supposed to be more secure. And in some marginal edge case, I'm sure it is. 99.999% of the time, it's just an annoyance though.
 Signature It was a fifty-four with a mashed up door and a cheesy little amp with a sign on the front said "Fender Champ" and a second-hand guitar it was a Stratocaster with a whammy bar
Howard Brazee - 02 May 2008 16:02 GMT >> We're talking about using crontab to edit cron tables, and vi/vim has >> beeen the default editor for crontab for, like forever. [quoted text clipped - 3 lines] >crontab actually has no default editor, it simply uses the EDITOR >defined in your environment settings. If someone is not interested in using Unix, won't use vi, but does use crontab - where should he put his .bash_profile or .bashrc file (created with textedit), and should the EDITOR= command look like, & what should he name it?
(This is a real question which I did not feel qualified to answer)
Jolly Roger - 02 May 2008 20:24 GMT > >> We're talking about using crontab to edit cron tables, and vi/vim has > >> beeen the default editor for crontab for, like forever. [quoted text clipped - 10 lines] > > (This is a real question which I did not feel qualified to answer) I'm not so sure you really can use a GUI editor to edit cron tables. I just tried with EDITOR set to TextWrangler's 'edit' command-line tool, and it exited immediately with:
export EDITOR=/usr/bin/edit # echo $EDITOR /usr/bin/edit # crontab -e crontab: no changes made to crontab
Not to mention, I fail to see why you'd even *want* to edit Unix cron tables with a GUI editor... Anyhow, I'll disregard that and assume you really do want to change your editor to a GUI tool...
If you're going to create any Unix configuration files with TextEdit, you'd better make damned sure you are saving the file as *Plain Text* and with *Unix* line breaks. If TextEdit can;t do this, don't even bother running TextEdit.
Personally, I'd just skip TextEdit completely and use a plain text editor that is designed for editing such files, like TextWrangler, which is free anyway, optionally installs an 'edit' command-line tool that allows TextWrangler to function as a replacement to various command-line editors.
.bashrc and .bash_profile both belong in your home directory (/Users/you). So open TextWrangler, and choose File > Open Hidden from the menu bar to look and see if you already have a ~/.bashrc or ~/.bash_profile.
If you already have these files, set TextWrangler's Open dialog box "Enable" menu to "All", then open the .bashrc file.
If you don't have .bash_profile, create a new document that has this content:
export ENV=~/.bashrc
if test -f ~/.bashrc; then . ~/.bashrc fi
Save the file as ".bash_profile" in your home folder, and be sure to click the Options button in the Save dialog box to specify you want *Unix* Line Breaks - otherwise the system will not read the file correctly.
If you *do* have .bash_profile, just make sure it contains the code above so your .bashrc will be source properly.
If you don't have .bashrc, create a new blank document. If you *do* have .bashrc, you can just open it and add to the end of it. You'll want to add a line to your .bashrc file that says:
export EDITOR=/usr/bin/edit
Save as plain text with Unix line breaks. When you are done, close and re-open a terminal window. To verify your changes worked, type:
echo $EDITOR
You should see the path to 'edit' echoed back to you, like this:
# echo $EDITOR /usr/bin/edit
 Signature Please send all responses to the relevant news group. E-mail sent to this address may be devoured by my very hungry SPAM filter. I do not read posts from Google Groups. Use a real news reader if you want me to see your posts.
JR
Howard Brazee - 02 May 2008 21:09 GMT >Personally, I'd just skip TextEdit completely and use a plain text >editor that is designed for editing such files, like TextWrangler, which >is free anyway, optionally installs an 'edit' command-line tool that >allows TextWrangler to function as a replacement to various command-line >editors. I did mention that - I'll push it. Thanks (for the rest of the message as well).
Howard Brazee - 02 May 2008 22:50 GMT >Personally, I'd just skip TextEdit completely and use a plain text >editor that is designed for editing such files, like TextWrangler, which [quoted text clipped - 6 lines] >the menu bar to look and see if you already have a ~/.bashrc or >~/.bash_profile. On my computer (not the computer of the guy who wanted my help) I opened TextWrangler and found a .bash_history and a bash_profile file (in HBrazee). The latter I created myself and it consists of one line saying: ls
I was hoping that when I started Terminal, I would see ls run, but nothing happens. So I try running it (obviously incorrectly):
Last login: Thu May 1 19:48:45 on console bHoward-Brazees-Computer:~ HBrazee$ bash_profile -bash: bash_profile: command not found Howard-Brazees-Computer:~ HBrazee$
Jolly Roger - 02 May 2008 23:53 GMT > >Personally, I'd just skip TextEdit completely and use a plain text > >editor that is designed for editing such files, like TextWrangler, which [quoted text clipped - 20 lines] > -bash: bash_profile: command not found > Howard-Brazees-Computer:~ HBrazee$ You need to learn more about the commind-line environment. ; )
1. The BASH profile file should be named .bash_profile - note the period character at the beginning. If the file is not named correctly, and does not exist in your home folder, BASH will not read it.
2. Why are you trying to run a script? My instructions showed you how to set up .bash_profile and .bashrc - those are not your average, ordinary shell scripts - in the sense that the BASH environment looks specifically for these files during initialization of your shell session. In other words, there are certain things that are appropriate to put in these files, and 'ls' isn't one of them. If you want to write a script, you really shouldn't use a name like .bash_profile, because that name is reserved for BASH in this context. Instead, call it something like "my_script.sh". The ".sh" filename extension denotes shell scripts.
3. If you create a script file from scratch, chances are it won't be executable by you or any other user or group until you make it so. To make a script file executable, you would need to issue the 'chmod +x /path/to/script' command.
4. To run any executable file (including a shell script) that is not in one of the paths listed in your PATH environment variable, you'll need to (a) use 'cd' to change to the directory containing the executable file, then (b) issue the './scriptname.sh' command to run it from within the current directory. Remember, on the command line, . means "the current directory, just as .. means "the parent of the current directory".
 Signature Please send all responses to the relevant news group. E-mail sent to this address may be devoured by my very hungry SPAM filter. I do not read posts from Google Groups. Use a real news reader if you want me to see your posts.
JR
Howard Brazee - 03 May 2008 01:52 GMT >1. The BASH profile file should be named .bash_profile - note the period >character at the beginning. If the file is not named correctly, and does >not exist in your home folder, BASH will not read it. > >2. Why are you trying to run a script? To test to see if I had it with the right name and location.
Jolly Roger - 03 May 2008 03:02 GMT > >1. The BASH profile file should be named .bash_profile - note the period > >character at the beginning. If the file is not named correctly, and does [quoted text clipped - 3 lines] > > To test to see if I had it with the right name and location. Instead, try adding this line to it:
echo "It works!"
 Signature Please send all responses to the relevant news group. E-mail sent to this address may be devoured by my very hungry SPAM filter. I do not read posts from Google Groups. Use a real news reader if you want me to see your posts.
JR
Howard Brazee - 03 May 2008 02:02 GMT >1. The BASH profile file should be named .bash_profile - note the period >character at the beginning. If the file is not named correctly, and does >not exist in your home folder, BASH will not read it. I tried to rename it from the finder, but failed. So I saved it from TextWrangler, and it worked. So I will put in your code, test it, and then copy it to my iPod for the other guy's computer.
Jolly Roger - 03 May 2008 03:01 GMT > >1. The BASH profile file should be named .bash_profile - note the period > >character at the beginning. If the file is not named correctly, and does [quoted text clipped - 3 lines] > TextWrangler, and it worked. So I will put in your code, test it, and > then copy it to my iPod for the other guy's computer. This whole notion of using GUI tools to edit command-line configuration files is a.s backwards if you want my opinion. If you want to learn about the command line, then you need to invest enough time and energy to learn enough about it to use it.
In this case, all you need to do is learn *a* command-line text editor. There are *plenty* from which to choose, and most are viewed by many to be much more user-friendly than vi/vim - one that comes to mind is 'pico'. Perhaps you should try using pico to create / edit these files:
To edit the .bash_profile file:
pico ~/.bash_profile
Add this to the file:
export ENV=~/.bashrc if test -f ~/.bashrc; then . ~/.bashrc fi
To edit the .bashrc file:
pico ~/.bashrc
Add this to file:
export EDITOR=/usr/bin/pico
Then close the terminal window and open a new one. Now your command-line editor should be 'pico'. To verify that, enter this command:
echo $EDITOR
 Signature Please send all responses to the relevant news group. E-mail sent to this address may be devoured by my very hungry SPAM filter. I do not read posts from Google Groups. Use a real news reader if you want me to see your posts.
JR
Howard Brazee - 03 May 2008 03:13 GMT >This whole notion of using GUI tools to edit command-line configuration >files is a.s backwards if you want my opinion. If you want to learn >about the command line, then you need to invest enough time and energy >to learn enough about it to use it. I might go with Pico - but I doubt the GUI is just what my friend says he wants.
Howard Brazee - 03 May 2008 14:36 GMT >>This whole notion of using GUI tools to edit command-line configuration >>files is a.s backwards if you want my opinion. If you want to learn [quoted text clipped - 3 lines] >I might go with Pico - but I doubt the GUI is just what my friend says >he wants. I don't doubt it's what John wants.
I changed my files to use Pico, but TextWrangler still comes up. I even shut down my Mac in between.
Chris Ridd - 03 May 2008 14:40 GMT >>> This whole notion of using GUI tools to edit command-line configuration >>> files is a.s backwards if you want my opinion. If you want to learn [quoted text clipped - 8 lines] > I changed my files to use Pico, but TextWrangler still comes up. I > even shut down my Mac in between. Er, *how* did you change them to use Pico? Bear in mind the Unix side of things (eg crontab) generally knows *nothing* about the Mac side of things. For example "Open with" settings in the Finder are Mac things and Unix tools will use what you've set in $EDITOR instead, or something like vi.
Cheers,
Chris
Howard Brazee - 03 May 2008 15:01 GMT >Er, *how* did you change them to use Pico? Bear in mind the Unix side >of things (eg crontab) generally knows *nothing* about the Mac side of >things. For example "Open with" settings in the Finder are Mac things >and Unix tools will use what you've set in $EDITOR instead, or >something like vi. I edited the two .bash* files, and cut and pasted code from this thread into them.
Chris Ridd - 03 May 2008 16:58 GMT >> Er, *how* did you change them to use Pico? Bear in mind the Unix side >> of things (eg crontab) generally knows *nothing* about the Mac side of [quoted text clipped - 4 lines] > I edited the two .bash* files, and cut and pasted code from this > thread into them. Do you know if the .bash* files were executed when you started a new Terminal window? A swift:
echo "Hello mum"
In each file (echo something different in each one :-) will tell you.
Cheers,
Chris
Howard Brazee - 03 May 2008 19:29 GMT >Do you know if the .bash* files were executed when you started a new >Terminal window? A swift: > >echo "Hello mum" > >In each file (echo something different in each one :-) will tell you. Last login: Sat May 3 07:26:19 on ttys000 .bashrc .bash_profile Howard-Brazees-Computer:~ HBrazee$
I edit .bashrc from the terminal and Text Wrangler opens with: export EDITOR=/usr/bin/pico echo ".bashrc"
I edit .bash_profile from and Text Wrangler opens with: export ENV=~/.bashrc if test -f ~/.bashrc; then . ~/.bashrc fi echo ".bash_profile"
Terminal shows the following:
Last login: Sat May 3 07:26:19 on ttys000 .bashrc .bash_profile Howard-Brazees-Computer:~ HBrazee$ edit .bashrc Howard-Brazees-Computer:~ HBrazee$ edit .bash_profile Howard-Brazees-Computer:~ HBrazee$
Jolly Roger - 03 May 2008 20:40 GMT > Howard-Brazees-Computer:~ HBrazee$ edit .bashrc > Howard-Brazees-Computer:~ HBrazee$ edit .bash_profile UWhat you apparently don't realize is the 'edit' command-line tool *is* part of TextWrangler. So it will naturally open TextWrangler when you issue it. ; )
If you want to use the 'pico' command-line tool to edit these files instead, then all you need to do is:
pico .bashrc pico .bash_profile
If you wanted to use vi to edit them, you'd:
vi .bashrc vi .bash_profile
Make sense?
 Signature Please send all responses to the relevant news group. E-mail sent to this address may be devoured by my very hungry SPAM filter. I do not read posts from Google Groups. Use a real news reader if you want me to see your posts.
JR
Howard Brazee - 03 May 2008 20:54 GMT >UWhat you apparently don't realize is the 'edit' command-line tool *is* >part of TextWrangler. So it will naturally open TextWrangler when you [quoted text clipped - 12 lines] > >Make sense? Yes. But I thought there was a Unix setting to define the default editor, and the command to invoke the default editor was "edit". I guess I was wrong.
Jolly Roger - 03 May 2008 20:59 GMT > >UWhat you apparently don't realize is the 'edit' command-line tool *is* > >part of TextWrangler. So it will naturally open TextWrangler when you [quoted text clipped - 16 lines] > editor, and the command to invoke the default editor was "edit". I > guess I was wrong. The Unix default editor is used for things where an editor is launched automatically, such as when you type 'crontab -e', for instance.
The 'edit' command-line tool is not part of the standard Mac OS X command-line tool set. It's (optionally) installed by TextWrangler thee very first time you launch TextWrangler.
 Signature Please send all responses to the relevant news group. E-mail sent to this address may be devoured by my very hungry SPAM filter. I do not read posts from Google Groups. Use a real news reader if you want me to see your posts.
JR
Chris Ridd - 04 May 2008 07:15 GMT >>> UWhat you apparently don't realize is the 'edit' command-line tool *is* >>> part of TextWrangler. So it will naturally open TextWrangler when you [quoted text clipped - 19 lines] > The Unix default editor is used for things where an editor is launched > automatically, such as when you type 'crontab -e', for instance. The key word here is "automatically".
Manually, you can run anything you want.
Cheers,
Chris
Howard Brazee - 05 May 2008 15:06 GMT >The Unix default editor is used for things where an editor is launched >automatically, such as when you type 'crontab -e', for instance. > >The 'edit' command-line tool is not part of the standard Mac OS X >command-line tool set. It's (optionally) installed by TextWrangler thee >very first time you launch TextWrangler. That's what he wanted - and in my ignorance, I didn't understand how the $EDITOR setting worked.
Lewis - 07 May 2008 22:33 GMT >>This whole notion of using GUI tools to edit command-line configuration >>files is a.s backwards if you want my opinion. If you want to learn >>about the command line, then you need to invest enough time and energy >>to learn enough about it to use it.
> I might go with Pico - but I doubt the GUI is just what my friend says > he wants. pico doesn't really exist on OS X anyway, it's a symlink to nano.
BBedit (and I presume TextWrangler) work fine as EDITORs for the shell.
 Signature "Oh damn", said Maladict.
Chris Ridd - 03 May 2008 06:34 GMT >>>> We're talking about using crontab to edit cron tables, and vi/vim has >>>> beeen the default editor for crontab for, like forever. [quoted text clipped - 20 lines] > # crontab -e > crontab: no changes made to crontab The man page for edit talks about how to make crontab run it properly, and how to make other Unix tools run it via $EDITOR.
Cheers,
Chris
Jolly Roger - 03 May 2008 06:48 GMT > > I'm not so sure you really can use a GUI editor to edit cron tables. I > > just tried with EDITOR set to TextWrangler's 'edit' command-line tool, [quoted text clipped - 8 lines] > The man page for edit talks about how to make crontab run it properly, > and how to make other Unix tools run it via $EDITOR. Thanks - I hadn't bothered to read the man page, because vim suits my needs perfectly, so I've never bothered to switch my editor.
 Signature Please send all responses to the relevant news group. E-mail sent to this address may be devoured by my very hungry SPAM filter. I do not read posts from Google Groups. Use a real news reader if you want me to see your posts.
JR
Chris Ridd - 03 May 2008 06:50 GMT >>> I'm not so sure you really can use a GUI editor to edit cron tables. I >>> just tried with EDITOR set to TextWrangler's 'edit' command-line tool, [quoted text clipped - 11 lines] > Thanks - I hadn't bothered to read the man page, because vim suits my > needs perfectly, so I've never bothered to switch my editor. I wonder if the bug in crontab alluded to at the end is still present?
Cheers,
Chris
Jolly Roger - 03 May 2008 06:57 GMT > >>> I'm not so sure you really can use a GUI editor to edit cron tables. I > >>> just tried with EDITOR set to TextWrangler's 'edit' command-line tool, [quoted text clipped - 13 lines] > > I wonder if the bug in crontab alluded to at the end is still present? My take is that's not a bug, but is just the way it is, because of the way crontab parses the EDITOR environment variable.
 Signature Please send all responses to the relevant news group. E-mail sent to this address may be devoured by my very hungry SPAM filter. I do not read posts from Google Groups. Use a real news reader if you want me to see your posts.
JR
Chris Ridd - 03 May 2008 07:34 GMT >> I wonder if the bug in crontab alluded to at the end is still present? > > My take is that's not a bug, but is just the way it is, because of the > way crontab parses the EDITOR environment variable. OK, well the "feature" is certainly still in the 10.5.2 code:
<http://www.opensource.apple.com/darwinsource/10.5.2/cron-30/crontab/crontab.c>
Cheers,
Chris
Jolly Roger - 03 May 2008 08:20 GMT > >> I wonder if the bug in crontab alluded to at the end is still present? > > [quoted text clipped - 4 lines] > > <http://www.opensource.apple.com/darwinsource/10.5.2/cron-30/crontab/crontab.c Are you referring to line 435?:
execlp(editor, editor, Filename, (char *)NULL);
It does seem strange that they are passing editor (which contains the contents of the EDITOR environment variable), in its entirety for the first *and* second parameter. The first parameter is supposed to the pathname to the executable (edit), and the second parameter is supposed to be a list of arguments or switches to pass to the executable (-w). It seems they are instead passing "edit -w" and "edit -w" for both parameters, which is what causes the error:
# crontab -e crontab: edit -w: No such file or directory crontab: "edit -w" exited with status 1
 Signature Please send all responses to the relevant news group. E-mail sent to this address may be devoured by my very hungry SPAM filter. I do not read posts from Google Groups. Use a real news reader if you want me to see your posts.
JR
Chris Ridd - 03 May 2008 08:47 GMT >>>> I wonder if the bug in crontab alluded to at the end is still present? >>> [quoted text clipped - 8 lines] > > execlp(editor, editor, Filename, (char *)NULL); Yep.
> It does seem strange that they are passing editor (which contains the > contents of the EDITOR environment variable), in its entirety for the [quoted text clipped - 7 lines] > crontab: edit -w: No such file or directory > crontab: "edit -w" exited with status 1 The next argument's what the execed program will read as argv[0], so it is usually OK to pass the same string twice. Clearly in this case crontab is trying to exec a program literally called "edit -w".
My best guess on the behaviour is that it was considered too risky to try securely parsing the $EDITOR value into multiple strings.
Cheers,
Chris
Jolly Roger - 03 May 2008 08:52 GMT > Clearly in this case > crontab is trying to exec a program literally called "edit -w". > > My best guess on the behaviour is that it was considered too risky to > try securely parsing the $EDITOR value into multiple strings. I bet.
 Signature Please send all responses to the relevant news group. E-mail sent to this address may be devoured by my very hungry SPAM filter. I do not read posts from Google Groups. Use a real news reader if you want me to see your posts.
JR
Lewis - 07 May 2008 22:30 GMT >>> We're talking about using crontab to edit cron tables, and vi/vim has >>> beeen the default editor for crontab for, like forever. [quoted text clipped - 3 lines] >>crontab actually has no default editor, it simply uses the EDITOR >>defined in your environment settings.
> If someone is not interested in using Unix, won't use vi, but does use > crontab - where should he put his .bash_profile or .bashrc file > (created with textedit), and should the EDITOR= command look like, & > what should he name it? .bashrc should be in the user's root folder, $HOME/.bashrc or ~/.bashrc
As for the EDITOR? that depends what you want to use.
EDITOR="/usr/bin/nano"
for nano. If you prefer bbedit, then:
EDITOR="/usr/bin/bbedit -w --resume"
 Signature When the stars threw down their spears And watered heaven with their tears, Did He smile his work to see? Did He who made the Lamb make thee?
Jolly Roger - 02 May 2008 20:04 GMT > > We're talking about using crontab to edit cron tables, and vi/vim has > > beeen the default editor for crontab for, like forever. [quoted text clipped - 3 lines] > crontab actually has no default editor, it simply uses the EDITOR > defined in your environment settings. And the default EDITOR on most *nix systems is... *drum roll* ; )
 Signature Please send all responses to the relevant news group. E-mail sent to this address may be devoured by my very hungry SPAM filter. I do not read posts from Google Groups. Use a real news reader if you want me to see your posts.
JR
Bob Harris - 25 Apr 2008 01:55 GMT > > I think you have to tell the consultant to fix what he's broken. > > There's a reason you're paying them mega bucks, eh? [quoted text clipped - 8 lines] > > Anyhow, if this problem is going to get solved I have to do it. Maybe you can now become a consultant to the company :-)
Bob Harris
Robert Peirce - 25 Apr 2008 03:17 GMT > Maybe you can now become a consultant to the company :-) > > Bob Harris I may have to.
 Signature Robert B. Peirce, Venetia, PA 724-941-6883 bob AT peirce-family.com [Mac] rbp AT cooksonpeirce.com [Office]
Bob Harris - 24 Apr 2008 00:46 GMT > > > > > I still don¹t know how to create a crontab in the standard way. > > > > > Crontab [quoted text clipped - 25 lines] > I don't think that is the issue. Crontab -e used to work before we > re-installed the OS. Something got changed, but I don't know what. I think you need to check the state of the various Vim backup options when doing a 'crontab -e'
:set backup causes me to get the following error:
"crontab.sgCEIjluOl" 2L, 28C written crontab: temp file must be edited in place
:set backup? backup
is how you can see what the current 'backup' option setting.
:help backup
may give you more information.
NOTE: This may not be the only Vim option that can shoot-you-in-the-foot. There might be 'writebackup', 'backupdir', 'backupskip', 'backupcopy', 'backupext', or some that are not obvious to me.
:set all
will tell you ALL of the Vim options and their current settings
If you find any of these options are set in a way to trigger the crontab behavior, then start looking for the .vimrc or .exrc file that might be causing it. If you do a
:help vimrc
you will find a list of all the ways Vim can be initialized. Including environment variables such as VIMINIT or EXINIT, or $VIM/vimrc
If you are unsure what .vimrc files are being called, you could try just running your editor with the -v option
vim -V some.random.file
Which should tell you all the files that Vim is 'sourcing' as it starts up.
Bob Harris
Robert Peirce - 24 Apr 2008 13:37 GMT > I think you need to check the state of the various Vim backup > options when doing a 'crontab -e' [quoted text clipped - 43 lines] > > Bob Harris Thanks for the leads. I'll check them out. Although we didn't consciously change anything that doesn't mean it didn't get changed.
 Signature Robert B. Peirce, Venetia, PA 724-941-6883 bob AT peirce-family.com [Mac] rbp AT cooksonpeirce.com [Office]
Robert Peirce - 24 Apr 2008 14:27 GMT > > I think you need to check the state of the various Vim backup > > options when doing a 'crontab -e' > > > > :set backup I found the problem. Now, what do I do about it? The /usr/share/vim/vimrc file contains the following lines:
" Don't write backup file if vim is being called by "crontab -e" au BufWrite /private/tmp/crontab.* set nowritebackup
It appears nowritebackup is not being set. If I manually enter
:se nowritebackup while editing a cron file, it seems to work okay.
This line seems to work correctly on 10.4.11 and 10.5.2 client and it used to work on 10.5.2 server, but now it isn't working. Is it possible the system vimrc file is not being read? How would I know? If not that, what else could it be?
 Signature Robert B. Peirce, Venetia, PA 724-941-6883 bob AT peirce-family.com [Mac] rbp AT cooksonpeirce.com [Office]
Bob Harris - 25 Apr 2008 02:42 GMT > > > I think you need to check the state of the various Vim backup > > > options when doing a 'crontab -e' [quoted text clipped - 15 lines] > the system vimrc file is not being read? How would I know? If not that, > what else could it be? OK, some suggestions:
1) Modify your own .vimrc to specify your own nowritebackup
autocmd BufReadPre,FileReadPre crontab.* set nowritebackup
NOTE 1: I am setting the value when the file is read, NOT when it is written.
NOTE 2: I did NOT specify a directory path. I just said any file that starts with crontab.* is treated this way.
2) Make the above modification to /usr/share/vim/vimrc
3) I would have suggested maybe putting a modeline (:help modelines) into the crontab file, but the /usr/share/vim/vimrc sets modelines=0 which disables modelines.
Bob Harris
Robert Peirce - 25 Apr 2008 03:16 GMT > OK, some suggestions: > [quoted text clipped - 10 lines] > > 2) Make the above modification to /usr/share/vim/vimrc Thanks, Bob. I'll try it as soon as I can.
 Signature Robert B. Peirce, Venetia, PA 724-941-6883 bob AT peirce-family.com [Mac] rbp AT cooksonpeirce.com [Office]
Robert Peirce - 25 Apr 2008 03:44 GMT > OK, some suggestions: > [quoted text clipped - 10 lines] > > 2) Make the above modification to /usr/share/vim/vimrc This works! Thanks, so much. I tried it first in my own .vimrc file then I put it in the system file.
I have been reviewing the vim help on "events." Actually seeing this really helped a lot.
Now I am wondering why BufReadPre and FileReadPre work but BufWrite does not. BufWrite is supposed to apply before writing, but there must be some kind of delay operating that is preventing this. Anyhow, you got it working for me and I appreciate it.
 Signature Robert B. Peirce, Venetia, PA 724-941-6883 bob AT peirce-family.com [Mac] rbp AT cooksonpeirce.com [Office]
Bob Harris - 25 Apr 2008 23:43 GMT > > OK, some suggestions: > > [quoted text clipped - 21 lines] > some kind of delay operating that is preventing this. Anyhow, you got it > working for me and I appreciate it. /usr/share/vim/vimrc specified /private/tmp/crontab.*, however, when I was doing my testing, I noticed that Vim thought the file was stored in /tmp/crontab.*
I am assuming that the real root of the problem is that they changed the behavior of crontab -e to use a different path for the file being edited. But no one thought to fix the /usr/share/vim/vimrc file.
Bob Harris
Robert Peirce - 26 Apr 2008 01:42 GMT > > > OK, some suggestions: > > > [quoted text clipped - 30 lines] > file being edited. But no one thought to fix the > /usr/share/vim/vimrc file. I had /private/tmp linked to /tmp. I picked that up in 10.4. I ran into a problem with some other program that had the same situation. Now I can't remember what it was. I guess I didn't realize I was also fixing cron!
More importantly, I got the original version of vimrc to work. I first tried your idea of removing the path and that worked. Then I put the path back in and it worked. The only thing I can figure is I must have had an unprintable character buried somewhere in the path and it got removed when I was playing with it.
I really appreciate everybody's help. It looks like everything is back together and working the way it is supposed to work.
 Signature Robert B. Peirce, Venetia, PA 724-941-6883 bob AT peirce-family.com [Mac] rbp AT cooksonpeirce.com [Office]
Bob Harris - 26 Apr 2008 00:23 GMT > > OK, some suggestions: > > [quoted text clipped - 21 lines] > some kind of delay operating that is preventing this. Anyhow, you got it > working for me and I appreciate it. I've submitted a bug report to Apple on /usr/share/vim/vimrc
<https://bugreport.apple.com/cgi-bin/WebObjects/RadarWeb.woa/54/wo/ IAMOWvqjyfWBzJsdhN6M4w/11.21>
Bob Harris
|
|
|