In OS X, you can write a plist file in
~/Library/LaunchAgents/ (or something similar, depending on what permissions/users you like it to be operated on), and load it using
launchctl to make it function on reboot. However, is it possible to define multiple commands in the plist file, and if that's the case, how can I define it?
For example, suppose that I want to run a series of Python programs, such as:
And then I want to run the script after the first script is done (so I cannot just define those two scripts in two different plist files, since it doesn't guarantee which one to be executed first), I want to run this script:
I use OS X Mavericks 10.9.2.
This is not what I want to do right now and comes from nothing but curiosity, but is it also possible to execute the second program depending upon the result of the first program? So for example:
And if this script succeeds:
python second_script.py --result true
And if it fails:
python second_script.py --result false --reason XXX