Jump to content


Incompatibility with cron

  • Please log in to reply
1 reply to this topic

#1 Eric Newbauer

Eric Newbauer

    Advanced Member

  • KB Moderators
  • PipPipPip
  • 266 posts

Posted 28 September 2006 - 05:04 PM

You have written a script that manually executes OK but the script fails with cron.

This is a known issue. SANmp's Command Line Interface (CLI) is incompatible with cron. A workaround is to use Apple's iCal application, which can be configured to schedule the routine processing of a script.

Edited by Moderator, 28 September 2006 - 05:08 PM.

Eric Newbauer, SNS Moderator
Learn about our SAN/NAS shared media storage products
Follow Studio Network Solutions on Twitter

#2 SNSjason


    Advanced Member

  • KB Moderators
  • PipPipPip
  • 39 posts

Posted 14 February 2012 - 01:31 PM

In recent versions of OS X, launched has superseded the cron utility. SANmp CLI mode works well with this method of launching.

As an example, I have created the following script, which will log in to SANmp, mount Vol1 and Vol2 as RW, and then create a file on each, named for the current date and time. It then unmounts them and logs out.

VOLS="Vol1 Vol2"
/opt/local/bin/SANmpClient login 1 1
for VOL in $VOLS; do
	    /opt/local/bin/SANmpClient mount volume $VOL RW
	    touch /Volumes/$VOL/`date +'%Y-%m-%d_%H-%M'`
	    /opt/local/bin/SANmpClient unmount volume $VOL
/opt/local/bin/SANmpClient logout

In the home directory of my user ("admin"), I created a directory called "bin", and placed this script inside that with a filename of SANmpTag.bash. I then made the script executable with "chmod".

Next, I created a directory at ~/Library/LaunchAgents which the launchd process scans for plist files. I created the following file with a name of com.studionetworksolutions.SANmpTag.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">







This launchd plist will execute the script every 10 minutes (600 seconds), and redirect the output to a couple files in the /tmp/ directory.