Using Launchd to run script

I have a remote backup solution setup on client machine OSX 10.4.
It has an in built scheduler which should run the jobs every 1 hour but when the users put the macbook to sleep or shut the lid, the scheduler gets confused when the lid is re-open.

I need a way of either restarting the service when the user logs back in or run the file every hour rather than using the in build sheduler.

I can successfully run this code in terminal "sudo SystemStarter restart CeruleanDVM". How would I run this using launchd?

Else I can this this script by first browsing to the applications directory and running the script. e.g CD /Applications/"Cerulean DataVault Manager"/bin and then running "sh". How would i implement this using launchd.
I made an attempt to use lingon to generate the script but it errors with file or directory not found.

Please advise
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

For ease of configuration, I recommend using the free and open source graphical tool called Lingon available from the following download site.


The current version is for Mac OS X 10.5, but that page also has a link to download the previous version which works with Tiger. The home site for this project is as follows.


The source code is available from the sourceforge site.


Please let me know if this was of help.

M4NNYAuthor Commented:
I have looked into Lingon. The problem i was facing was when i generated the plist file using Lingon, it could not run because it came back with file or directory not found. My guess is that it does not like the spaces between Cerulean DataVault Manager, even though the full path was put under quotations or it does not like the way the script is executed.

My script resides in the application directory as show below:
/Applications/Cerulean DataVault Manager/bin/

Hope the information is more clearer
Did you try the alternative of escaping the spaces in the path by using backslashes?
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

M4NNYAuthor Commented:
Tried that too but still receiving the same issue.

Switched over to scheduling jobs using Cronnix but there i received a similar.

Not sure if this issue is related to the OS or the script it is trying to run
If you're able to get the script to run in other ways as you mentioned (using SystemStarter and also by browsing to the directory and running it from there) then it seems like the script itself is fine. I'm guessing that the problem must be specific to the configuration for launchd to use the script.  

What error did you receive when trying to use Cronnix? This does seem more like a script that should be run as a cron job, anyway.
M4NNYAuthor Commented:
When running the script using both the launchd and cronnix, the error was file or folder not found.
M4NNYAuthor Commented:
Please close

Found an alternative solution to my problem
Question PAQ'd, 500 points refunded, and stored in the solution database.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Shell Scripting

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.