Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > Perl script on startup

Perl script on startup
Thread Tools
Addicted to MacNN
Join Date: Sep 2000
Status: Offline
Reply With Quote
Apr 13, 2003, 05:03 PM
 
Anyone know how to get a perl script to run on startup as root? It runs indefinately. I tried using:

Code:
#!/bin/sh # # ********************************************************************* # ** /Library/StartupItems/PerlScript/Script ** # ********************************************************************* # ** ** # ** To configure script to launch: as root, edit the file ** # ** /etc/hostconfig After the SCRIPT entry, add this line: ** # ** SCRIPT=-YES- You can easily change this entry to enable ** # ** or disable the Script whenever you like. ** # ** ** # ** ** # ********************************************************************* # # --------------------------------------------------------------------- # Include system wide configuration options # --------------------------------------------------------------------- . /etc/rc.common # --------------------------------------------------------------------- # Start script # --------------------------------------------------------------------- if [ "${SCRIPT:=-NO-}" = "-YES-" ]; then ConsoleMessage "Starting SCRIPT" /usr/bin/perl /path/to/script.pl -option fi
then for StartupParameters.plist
Code:
{ Description = "script loader"; Provides = ("script"); Requires = ("Resolver"); OrderPreference = "None"; Messages = { start = "Starting Script"; stop = "Stopping Script"; }; }
But this all resulted in the system hanging indefinately on startup.

The script never ends, it runs with no output as a process. it should do that... but the system should just leave it running in the background to do it's work.


Any ideas?
I always use protection when fscking my Mac... Do you?
     
Professional Poster
Join Date: Oct 1999
Location: :ИOITAↃO⅃
Status: Offline
Reply With Quote
Apr 13, 2003, 05:27 PM
 
Add & to the end of the line calling your script, to run it in the background:

Code:
/usr/bin/perl /path/to/script.pl -option &
     
Addicted to MacNN
Join Date: Sep 2000
Status: Offline
Reply With Quote
Apr 13, 2003, 09:02 PM
 
Originally posted by Mithras:
Add & to the end of the line calling your script, to run it in the background:

Code:
/usr/bin/perl /path/to/script.pl -option &
Is this all seriously that simple?





Thanks.
I always use protection when fscking my Mac... Do you?
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 07:55 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2