Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I’d like to automatically copy the contents of a file file.a to file.a.b whenever file.a is saved by any program. The following is what I tried so far with a LaunchAgent, but it doesn’t work yet.

1. Create script to copy the file contents

say "Script is running"
cd /path/to/folder
cat file.a > file.a.b

make it active with chmod -x This script works when I run it manually via sh or with a global hotkey from Alfred.

2. Create a LaunchAgent
I build it with Lingo but saved it manually since Lingo won’t save the file …

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">

3. Save LaunchAgent
I saved the agent as ~/Library/LaunchAgents/de.tweh.DoCopy

4. Restart
Restart my Mac to activate the LaunchAgent.

What am I doing worg?

The Console gives this (useless?) error message:

16.06.13 00:44:04,005[153]:
(de.tweh.DoCopy[326]) Job failed to exec(3) for weird reason: 13
share|improve this question

closed as too localized by Mark, patrix Jun 16 '13 at 11:37

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Have you looked at the Console application to see what the logs say? – ayaz Jun 15 '13 at 17:41
@ayaz: Not yet, but it isn’t helpful (for me) … see my edit … – Tobi Jun 15 '13 at 22:44
@ayaz: Thanks that led me to the solution :-) – Tobi Jun 16 '13 at 10:23
up vote 0 down vote accepted

I found the error: I used chmod -x instead of chmod +x. Now it works fine :-)

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.