Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

init.d scripts



On Mon, 2006-01-30 at 10:32 -0500, David Kramer wrote:
> I'm trying to write an init.d script for a FC4 system.  Does anyone have a
> good tutorial for that?
> 
> The thing that I'm stuck on is that the "daemon" function appears to expect
> the first non-dashed parameter as the thing to run, and it also uses that
> parameter to form the pidfile name.
> 
> My problem is I am setting up to run a PHP script, so the command needs to be
> "php myscriptname.php foo bar", which I assume would create a pidfile called
> php.pid, which is not good.  I would rather not make a separate one-line
> script to call it.
> 
> Any advice?

Yes, all you have to do is:

  1) add the following line to the top of your script:

     #!/usr/bin/env php

  2) and then make the script executable:

     chmod +x myscriptname.php

and then you can remove the explicit php invocation and just use:

  myscriptname.php foo bar

Ed

-- 
Edward H. Hill III, PhD
office:  MIT Dept. of EAPS;  Rm 54-1424;  77 Massachusetts Ave.
             Cambridge, MA 02139-4307
emails:  eh3 at mit.edu                ed at eh3.com
URLs:    http://web.mit.edu/eh3/    http://eh3.com/
phone:   617-253-0098
fax:     617-253-4464





BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org