Jump to content

Setting up a scheduled task using a bash script


Recommended Posts

Posted

Is there a simple way of setting up a scheduled task on a Mac via the command line or a Bash script?

 

Reason I ask is, since we've moved to Mavericks our Macs have a very annoying habit of buggering up their disk permissions. Only admin users have permission to access the /Applications folder. This means that all standard users see is a long line of question marks along the dock and they can't run any other apps either.

 

Going into the disk utility and running Repair Permissions fixes this as does opening a terminal session and running "diskutil repairPermissions /" from a terminal session.

 

So what I'd like to is to set up a scheduled task via a bash script to run "diskutil repairPermissions /" every Monday morning at 9.00 and to run the task if it gets missed because the machine is off. I don't care if it uses cron or launchd just so long as it works! I've tried looking online but I find the documentation for both to be inscrutable.

 

Cheers,

 

Norphy

Posted

Just as I was doing this today, the manual alternative is to use (Apple) Remote Desktop.

 

Select all machines.

Manage->Send Unix Command.

diskutil repairPermissions /

(or use the template)->Send

Once it's in your history you can just click retry.

 

It tells you if it succeeds or not

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...