I have a piece of code in my application which i use to create a crontab. When i compile and run it from my xcode, the code works perfectly fine without errors and places a cronjob at the time specified.
NSDictionary *error = [NSDictionary new];
NSString *script = @"do shell script \" crontab -l > mycron ; echo '30 11 * * * cd /Applications/PagePlannerMac && ./JunkDataDeleteScript.sh >> /Applications/PagePlannerMac/scriptlogs.log' >> mycron ; crontab mycron ; rm mycron\" ";
NSAppleScript *appleScript = [[NSAppleScript alloc] initWithSource:script];
if ([appleScript executeAndReturnError:&error]) {
NSLog(@"success!");
} else {
NSLog(@"failure!");
}
Basically what the code does is it executes a shell command to create the cron.
When i compile and get the dmg file of my application, install and test. The cron does not execute, there are no errors or crashes. Not sure what is causing it to fail. Any help is apprecitated.