Solved

Using Launchd to run backup.sh script

Posted on 2008-11-02
9
932 Views
Last Modified: 2013-12-21
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 backupset.sh 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 RunBackupset.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
0
Comment
Question by:M4NNY
  • 4
  • 3
9 Comments
 
LVL 1

Expert Comment

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

<http://www.macupdate.com/info.php/id/19879/lingon>

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.

<http://tuppis.com/lingon/>

The source code is available from the sourceforge site.

<http://sourceforge.net/projects/lingon/>

Please let me know if this was of help.


0
 

Author Comment

by:M4NNY
ID: 22868940
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/RunBackupset.sh

Hope the information is more clearer
0
 
LVL 1

Expert Comment

by:Southron
ID: 22869190
Did you try the alternative of escaping the spaces in the path by using backslashes?
0
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 

Author Comment

by:M4NNY
ID: 22920984
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
0
 
LVL 1

Expert Comment

by:Southron
ID: 22924104
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.
0
 

Author Comment

by:M4NNY
ID: 22967716
When running the script using both the launchd and cronnix, the error was file or folder not found.
0
 

Author Comment

by:M4NNY
ID: 23647679
Please close

Found an alternative solution to my problem
0
 

Accepted Solution

by:
ee_auto earned 0 total points
ID: 25221226
Question PAQ'd, 500 points refunded, and stored in the solution database.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Apple's line of laptop computers has made significant strides forward in the last few years. The biggest change being the switch to Intel processors in 2005. One thing about Apple hardware, especially that from a few years ago, is the tendency for i…
Smartwatches: just a fashion accessory or a useful device for all? The Apple Watch (http://www.apple.com/watch/) was launched in April of 2015 and has become a new way for iPhone users to stay connected. Ranging from $349 to $17,000, the Apple Watch…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question