Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

running MAC OS X maintenance scripts manually in terminal mode

I'm trying to run the maintenance scripts manually in terminal but I get the error message "-bash sudo: command not found"
and the same when I try to determine when the scripts were last run "-bash: ls: command not found"

I'm using the command (in Panther)

sudo periodic daily weekly monthly

to run them all

and

ls -al/var/log/*.out

to check when they were last run.


Thanks.

Peter

G5 Mac OS X (10.3.9)

Posted on Jun 8, 2007 8:12 AM

Reply
18 replies

Jun 16, 2007 7:30 PM in response to Michael Conniff

I got a little swamped at work and have not had time to look at the files yet. I have a more basic question though, and that is when I try to execute the command

ls -a

shouldn't I get a list of files in the current directory?

I get (when I try to run it from my home directory)

-bash: ls: command not found

What does that mean??? Before I start moving files around I'd like to be able to look at my directories.

Peter

Power Book G4 Mac OS X (10.3.9)

Jun 17, 2007 8:47 AM in response to Peter Robertson

Peter

Before I start moving files around I'd like to be able to look at my directories.

I haven't yet asked you to move any files around, just to look to see which file is messing up your path.

I go away tomorrow for a week. You can take my advice or not.

Open the Terminal (from /Applications/Utilities) and copy and paste the following into the Terminal window followed by a return:

export PATH="${HOME}/${MACHTYPE}/bin:${HOME}/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbi n:/sbin"

Now try using ls or any of the other commands: magic isn't it?

You should now be able to run

sudo periodic daily weekly monthly

(and supply your password) to run all your maintenance tasks. Note the password is not echoed, you must type it blind, followed by a return.

OK so far, but the minute you quit Terminal you will lose that nice path that let's you do this stuff, and you don't want to type that every time, do you?

So I prepared these instructions for you in advance. I really wanted to see which of your files had got the wrong entry, and discover how that had happened, but no time for that now.

We'll set up a decent .bash_profile and .bashrc for you. You will need both, since I have arranged for .bash_profile to source .bashrc. That way you will have the same environment in all your Terminal windows.

Note some of this will involve secondary prompts, e.g. ' >' which you don't type or copy; just the stuff in black.

Open the Terminal (from /Applications/Utilities) and copy and paste the following into the Terminal window, one line at a time, with a return after each line:

/bin/cat >| ~/.bashrc <<END
>export PATH="${HOME}/${MACHTYPE}/bin:${HOME}/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbi n:/sbin"
>export MANPATH="${HOME}/man:/usr/local/share/man:/usr/share/man"
>END
/bin/cat >| ~/.bash_profile <<END
>if [ -r ~/.bashrc ]; then
> . ~/.bashrc
>fi
>END

You will need to quit Terminal and restart it for this to take effect. Then all the standard commands will be available without you needing to specify the complete path.


There. Don't forget to copy and paste all of that, because the shell is very picky about this stuff and will not tolerate errors.

running MAC OS X maintenance scripts manually in terminal mode

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