/dev/null issues

Hello All,

I have an issue since the last couple Leopard updates that I can't seem to get a handle on and think I am out of my element here so any advice appreciated.

I run 2 scripts every 10 minutes for the past 3 years and always had good results with them.

In Cronnix I have them setup as "pathToScript" >/dev/null 2>&1

One sends an email and the other runs a php cron. Both work well even now.

The only issue is that I now get an email saying:

/bin/sh: dev/null: No such file or directory

When the scripts run there is an entry in Console :

5/17/09 3:16:23 PM MyMac Ambiguous output redirect.

Thinking there is a directory missing I listed /dev/ in terminal and did receive the list of dev contents... but no null directory in the list.

I viewed the hard drive using invisibles and saw that /dev existed, but it appears when viewed as an alias, don't know if that is normal or not. I cannot move or delete the alias due to not enough permissions (might be a good thing lol)

I chowned dev/null to root:wheel from googled advice, and got no errors either.

My problem is that I don't want these emails, and wonder what is wrong with the way /dev/null is working , or not working now, and how to fix it. Can I rebuild dev/null? or fix it otherwise? Is there a fix all commend for this phenomena?

Any advice is greatly appreciated.

Jamy

Message was edited by: Jamy

iMac C2D 2Ghz, 2 x Mini C2D 2Ghz, G3 Lombard PB,, Mac OS X (10.5.7), AEBS, ATV

Posted on May 17, 2009 11:35 AM

Reply
9 replies

May 17, 2009 3:20 PM in response to BobHarris

Bob,
I always repair permissions before and after every OS update, so not a problem.
In Terminal I did:
OfficeMac:~ office$ echo I should not see this >/dev/null
returned nothing
OfficeMac:~ office$ ls -l /dev/null
returned:
crw-rw-rw- 1 root wheel 3, 2 May 17 19:05 /dev/null

BUT, after seeing that all was well I went back and checked Cronnix. I was missing a "/" before the dev !!!
The emails were telling me no such directory ( as dev/null/ )
DUHHHH! I must have changed them while testing them after a Leopard update!! I remember adding the 2>&1 chars to the line at one time, must have been then that I changed them.

But I still get the Ambiguous output redirect message, although the emails stopped.

Sorry for taking up your valuable time on this, but you did help solve it.

Thanks much!
Jamy

Message was edited by: Jamy

May 18, 2009 9:16 AM in response to Jamy

But I still get the Ambiguous output redirect message, although the emails stopped.


I seem to recall getting a similar message when trying to redirect stderr using tcsh. I wonder if connix is using that shell. You might try something like:
<pre style="border: 1px solid #ddd; padding-left: .75ex; padding-top: .25em; padding-bottom: .25em; margin-top: .5em; margin-bottom: .5em; margin-left: 1ex; max-width: 40ex; overflow: auto; font-size: 10px; font-family: Monaco, 'Courier New', Courier, monospace; color: #444; background: #eee; line-height: normal">sh -c 'path/to/script >/dev/null 2>&1'</pre>
--
Cole

May 27, 2009 1:17 PM in response to Jamy

Was I supposed to get something?


It depends what your script outputs. The idea was to have bash handle the output redirection to see if it you could suppress the ambiguous output redirect message. If you included the >/dev/null 2>&1 part, then I would expect to see no output. My guess was that maybe connix is using tcsh. The following tests seem to support that theory:
<pre style="border: 1px solid #ddd; padding-left: .75ex; padding-top: .25em; padding-bottom: .25em; margin-top: .5em; margin-bottom: .5em; margin-left: 1ex; max-width: 40ex; overflow: auto; font-size: 10px; font-family: Monaco, 'Courier New', Courier, monospace; color: #444; background: #eee; line-height: normal">tcsh -c 'echo hello >/dev/null 2>&1'
tcsh: Ambiguous output redirect.

sh -c 'echo hello >/dev/null 2>&1'
(no output)
</pre>
--
Cole

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

/dev/null issues

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.