PDA

View Full Version : Need help: Perl scripting




iAintKnowMac
Jun 28, 2013, 12:47 PM
i have created a perl script that does some stuff. (what it does is not important.) what i need to do is have the script run and reboot at the end and when the mac reboots, the script runs again. i need to make it so it will run and reboot for several days. How would i accomplish this?



kryten2
Jun 28, 2013, 01:00 PM
Info : launchd (https://developer.apple.com/library/mac/documentation/darwin/reference/manpages/man8/launchd.8.html)
launchd.plist (http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man5/launchd.plist.5.html)
http://nathangrigg.net/2012/07/schedule-jobs-using-launchd/

iAintKnowMac
Jul 1, 2013, 04:26 PM
I choose to use the cron method. I have made a crontab for a simple script, but when i try to use my actually script it does not open. I am running my script when the computer reboots, my script is saved on a flash drive. Can the Mac not run a script off of a flash drive at boot time?

chown33
Jul 1, 2013, 05:02 PM
I choose to use the cron method. I have made a crontab for a simple script, but when i try to use my actually script it does not open. I am running my script when the computer reboots, my script is saved on a flash drive. Can the Mac not run a script off of a flash drive at boot time?

Does the flash drive mount? When, exactly?

Break the problem down into smaller steps you can confirm. The most obvious initial breakdown is "Does the flash drive mount?" followed by "Does a script on the flash drive run?". Without the first, the second is moot.

If the flash drive isn't mounting, then you'll need to postpone whatever you're doing that needs it to be mounted.

iAintKnowMac
Jul 2, 2013, 10:55 AM
Instead of using the flash drive i just put files on the main drive. I finds the script just fine. Now the problem I'm having is when the cron tab run at boot time my script will run; it will mount as its supposed to, do what it needs to do, then it fails at unmounting. When i run the script in the terminal it works just fine.

chown33
Jul 2, 2013, 09:28 PM
Post more details:
http://www.mikeash.com/getting_answers.html

Error messages? Post them.

Failing commands? Post them.

What's being unmounted? Your 1st post said reboot; why unmount anything?

OS version?


Have you considered just making a .command file, which Terminal will run, and setting that as a Startup Item? Maybe no need for cron or other tricks, just tell Terminal what to run.