/**
  * Creates a shell script (.sh) in $scriptFullPath that calls a symfony task
  * $sfTaskCall. It then creates a symlink to the shell scrip from $cronPath.
  *
  * $cronPath must be one of the following:
  *   - /etc/cron.hourly
  *   - /etc/cron.daily
  *   - /etc/cron.weekly
  *   - /etc/cron.monthly
  *
  * This of course requires that the system is setup for this type of
  * configuration. The method is called generic because it makes use of one of
  * these pre-defined time slots.
  *
  * $scripFullPath must be a valid path including the name of the script file.
  * It is recommended that this be in the application directory called scripts.
  *
  * Example: /var/www/httpdocs/backend/1.0.2/apps/cron/scripts/myTaskCall.sh
  *
  * $sfTaskCall must be the complete command line to call the symfony task
  * including the full path and all parameters and options.
  *
  * Example: /var/www/httpdocs/backend/1.0.2/symfony ns:task --option=something
  * 
  * @param string $cronPath       Path to cron script call (ex: /etc/cron.hourly)
  * @param strint $scriptFullPath The full path of the script that cron will call
  * @param string $sfTaskCall     The sf task that the script should call (including parameters)
  */
 public static function generic($scriptFullPath, $sfTaskCall, $cronPath)
 {
     $DS = DIRECTORY_SEPARATOR;
     $pi = pathinfo($scriptFullPath);
     $scriptPath = $pi['dirname'];
     uFs::mkdir($scriptPath, true);
     uFs::chmod($scriptPath, 0755, true);
     $sh = '#!/bin/bash' . PHP_EOL;
     $sh .= 'php ' . sfConfig::get('sf_root_dir') . $DS . $sfTaskCall . PHP_EOL;
     $linkName = $cronPath . $DS . $pi['filename'];
     $target = $scriptFullPath;
     uFs::file_put_contents($scriptFullPath, $sh);
     uFs::chmod($scriptFullPath, 0777, true);
     uFs::symlink($target, $linkName, true);
 }
 /**
  * Check if the target path exists and if it is writable. Depending on the
  * $createIfNotExists parameter it will be created if it does not exist.
  *
  * @param <type> $fullPath
  * @param <type> $createIfNotExists
  * @return <type>
  */
 protected static function checkTargetPath($fullPath, $createIfNotExists = false)
 {
     $path = self::getBasePath($fullPath);
     if ($createIfNotExists) {
         uFs::mkdir($path, 0777, true);
     } else {
         uFs::file_exists($path, true);
         uFs::is_writable($path, true);
     }
     return true;
 }