PDA

View Full Version : Command Line Prog On Startup



rosco
28th June 2005, 12:48 PM
I have installed Squid (http://www.squid-cache.org) and it is running just fine, but I haven't been able to work out how to have Squid start up then the system starts.

At the moment after bootup I&#39;m starting it manually with "sudo /<path>/squid/sbin/squid /<path>/squid/etc/squid.conf".

I&#39;ve tried creating a file called "squid" in /etc/xinetd.d/ containing these lines:

{
disable = no
socket_type = stream
wait = no
user = nobody
server = "/usr/local/squid/sbin/squid /usr/local/squid/etc/squid.conf"
server_args =
groups = yes
flags = REUSE
}

This was basically a stab in the dark - I don&#39;t really understand it, so I&#39;m hoping to get a hint on how to have start up automatically...

Can anyone give me clue please?

Opps, edited to add this is on a MacMini with OSx 10.4.1&#33;

Currawong
28th June 2005, 12:59 PM
The simplest thing to do would be to create your own file in /Library/StartupItems to start it up. Otherwise, download Squidman, which I believe has options for at least starting it when you log in.

Inside any StartupItems folder, named after the application or whatever it is in there, you&#39;ll find a .plist file listing information about the startup item, and usually a shell script with a format like this: (example from Cocktail Network Optimisation startup item)


#&#33;/bin/sh
. /etc/rc.common
#CheckForNetwork
StartService &#40;&#41;
{
ConsoleMessage &#34;Optimizing network&#34;
/usr/sbin/sysctl -w net.inet.tcp.sendspace=62500 &#62; /dev/null
/usr/sbin/sysctl -w net.inet.tcp.recvspace=62500 &#62; /dev/null
/usr/sbin/sysctl -w net.inet.tcp.delayed_ack=0 &#62; /dev/null
/usr/sbin/sysctl -w net.inet.tcp.rfc1323=1 &#62; /dev/null
ConsoleMessage -S
}
StopService &#40;&#41;
{
return 0
}
RestartService &#40;&#41;
{
return 0
}
RunService &#34;&#036;1&#34;

The main features you&#39;ll see there are for the SystemStarter program which has three options, StartService, StopService and RestartService. I hope that&#39;s not a too brief overview of what to do ;)

rosco
28th June 2005, 05:05 PM
Damn... I need to start it as &#39;root&#39;, after which it switches to running as &#39;nobody&#39;... so that&#39;s not going to work.